swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: The Azure SQL Database management API provides a RESTful set of web APIs that interact with Azure SQL Database services to manage your databases. The API enables users to create, retrieve, update, and delete databases, servers, and other entities.
  title: SqlManagementClient
  version: 2018-06-01-preview
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/sql/resource-manager/Microsoft.Sql/preview/2018-06-01-preview/DatabaseSchema.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: sql-DatabaseSchema
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  azure_auth:
    authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
    description: Azure Active Directory OAuth2 Flow
    flow: implicit
    scopes:
      user_impersonation: impersonate your user account
    type: oauth2
parameters:
  ApiVersionParameter:
    description: The API version to use for the request.
    in: query
    name: api-version
    required: true
    type: string
    x-ms-parameter-location: client
  DatabaseNameParameter:
    description: The name of the database.
    in: path
    name: databaseName
    required: true
    type: string
    x-ms-parameter-location: method
  ResourceGroupParameter:
    description: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
    in: path
    name: resourceGroupName
    required: true
    type: string
    x-ms-parameter-location: method
  ServerNameParameter:
    description: The name of the server.
    in: path
    name: serverName
    required: true
    type: string
    x-ms-parameter-location: method
  SqlVirtualMachineContainerNameParameter:
    description: The name of the SqlVirtualMachineContainer.
    in: path
    name: sqlVirtualMachineContainerName
    required: true
    type: string
    x-ms-parameter-location: method
  SqlVirtualMachineInstanceNameParameter:
    description: The name of the SqlVirtualMachineInstance.
    in: path
    name: sqlVirtualMachineInstanceName
    required: true
    type: string
    x-ms-parameter-location: method
  SubscriptionIdParameter:
    description: The subscription ID that identifies an Azure subscription.
    in: path
    name: subscriptionId
    required: true
    type: string
    x-ms-parameter-location: client
  VirtualClusterNameParameter:
    description: The name of the virtual cluster.
    in: path
    name: virtualClusterName
    required: true
    type: string
    x-ms-parameter-location: method
paths:
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas":
    get:
      description: List database schemas
      operationId: DatabaseSchemas_ListByDatabase
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: An OData filter expression that filters elements in the collection.
          in: query
          name: $filter
          required: false
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved database schemas.
          schema:
            $ref: "#/definitions/DatabaseSchemaListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

             * 404 InvalidDatabaseSchema - Schema is missing in database.

             * 404 InvalidDatabaseTable - Table is missing in database.

             * 404 InvalidDatabaseColumn - Column is missing in table.
      tags:
        - DatabaseSchemas
      x-ms-examples:
        List database schemas:
          parameters:
            api-version: 2018-06-01-preview
            databaseName: myDatabase
            resourceGroupName: myRG
            serverName: serverName
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo
                    name: dbo
                    type: Microsoft.Sql/servers/databases/schemas
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/schema2
                    name: schema2
                    type: Microsoft.Sql/servers/databases/schemas
      x-ms-odata: "#/definitions/DatabaseSchema"
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}":
    get:
      description: Get database schema
      operationId: DatabaseSchemas_Get
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: The name of the schema.
          in: path
          name: schemaName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved database schema.
          schema:
            $ref: "#/definitions/DatabaseSchema"
        default:
          description: |-
            *** Error Responses: ***

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

             * 404 InvalidDatabaseSchema - Schema is missing in database.

             * 404 InvalidDatabaseTable - Table is missing in database.

             * 404 InvalidDatabaseColumn - Column is missing in table.
      tags:
        - DatabaseSchemas
      x-ms-examples:
        Get database schema:
          parameters:
            api-version: 2018-06-01-preview
            databaseName: myDatabase
            resourceGroupName: myRG
            schemaName: dbo
            serverName: serverName
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo
                name: dbo
                type: Microsoft.Sql/servers/databases/schemas
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables":
    get:
      description: List database tables
      operationId: DatabaseTables_ListBySchema
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: The name of the schema.
          in: path
          name: schemaName
          required: true
          type: string
        - description: An OData filter expression that filters elements in the collection.
          in: query
          name: $filter
          required: false
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved database tables.
          schema:
            $ref: "#/definitions/DatabaseTableListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

             * 404 InvalidDatabaseSchema - Schema is missing in database.

             * 404 InvalidDatabaseTable - Table is missing in database.

             * 404 InvalidDatabaseColumn - Column is missing in table.
      tags:
        - DatabaseTables
      x-ms-examples:
        List  database tables:
          parameters:
            api-version: 2018-06-01-preview
            databaseName: myDatabase
            resourceGroupName: myRG
            schemaName: dbo
            serverName: serverName
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo/tables/table1
                    name: table1
                    type: Microsoft.Sql/servers/databases/schemas/tables
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo/tables/table2
                    name: table2
                    type: Microsoft.Sql/servers/databases/schemas/tables
      x-ms-odata: "#/definitions/DatabaseTable"
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}":
    get:
      description: Get database table
      operationId: DatabaseTables_Get
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: The name of the schema.
          in: path
          name: schemaName
          required: true
          type: string
        - description: The name of the table.
          in: path
          name: tableName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved database table.
          schema:
            $ref: "#/definitions/DatabaseTable"
        default:
          description: |-
            *** Error Responses: ***

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

             * 404 InvalidDatabaseSchema - Schema is missing in database.

             * 404 InvalidDatabaseTable - Table is missing in database.

             * 404 InvalidDatabaseColumn - Column is missing in table.
      tags:
        - DatabaseTables
      x-ms-examples:
        Get database table:
          parameters:
            api-version: 2018-06-01-preview
            databaseName: myDatabase
            resourceGroupName: myRG
            schemaName: dbo
            serverName: serverName
            subscriptionId: 00000000-1111-2222-3333-444444444444
            tableName: table1
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo/tables/table1
                name: table1
                type: Microsoft.Sql/servers/databases/schemas/tables
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns":
    get:
      description: List database columns
      operationId: DatabaseColumns_ListByTable
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: The name of the schema.
          in: path
          name: schemaName
          required: true
          type: string
        - description: The name of the table.
          in: path
          name: tableName
          required: true
          type: string
        - description: An OData filter expression that filters elements in the collection.
          in: query
          name: $filter
          required: false
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved database columns.
          schema:
            $ref: "#/definitions/DatabaseColumnListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

             * 404 InvalidDatabaseSchema - Schema is missing in database.

             * 404 InvalidDatabaseTable - Table is missing in database.

             * 404 InvalidDatabaseColumn - Column is missing in table.
      tags:
        - DatabaseColumns
      x-ms-examples:
        List database columns:
          parameters:
            api-version: 2018-06-01-preview
            databaseName: myDatabase
            resourceGroupName: myRG
            schemaName: dbo
            serverName: serverName
            subscriptionId: 00000000-1111-2222-3333-444444444444
            tableName: table1
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo/tables/table1/columns/col1
                    name: col1
                    properties:
                      columnType: nvarchar
                    type: Microsoft.Sql/servers/databases/schemas/tables/columns
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo/tables/table1/columns/col2
                    name: col2
                    properties:
                      columnType: bit
                    type: Microsoft.Sql/servers/databases/schemas/tables/columns
      x-ms-odata: "#/definitions/DatabaseColumn"
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}":
    get:
      description: Get database column
      operationId: DatabaseColumns_Get
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/DatabaseNameParameter"
        - description: The name of the schema.
          in: path
          name: schemaName
          required: true
          type: string
        - description: The name of the table.
          in: path
          name: tableName
          required: true
          type: string
        - description: The name of the column.
          in: path
          name: columnName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved database column.
          schema:
            $ref: "#/definitions/DatabaseColumn"
        default:
          description: |-
            *** Error Responses: ***

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

             * 404 InvalidDatabaseSchema - Schema is missing in database.

             * 404 InvalidDatabaseTable - Table is missing in database.

             * 404 InvalidDatabaseColumn - Column is missing in table.
      tags:
        - DatabaseColumns
      x-ms-examples:
        Get database column:
          parameters:
            api-version: 2018-06-01-preview
            columnName: column1
            databaseName: myDatabase
            resourceGroupName: myRG
            schemaName: dbo
            serverName: serverName
            subscriptionId: 00000000-1111-2222-3333-444444444444
            tableName: table1
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo/tables/table1/columns/column1
                name: column1
                properties:
                  columnType: bit
                type: Microsoft.Sql/servers/databases/schemas/tables/columns
definitions:
  DatabaseColumn:
    allOf:
      - $ref: "#/definitions/ProxyResource"
    description: A database column resource.
    properties:
      properties:
        $ref: "#/definitions/DatabaseColumnProperties"
        description: Resource properties.
        x-ms-client-flatten: true
    type: object
  DatabaseColumnListResult:
    description: A list of database columns.
    properties:
      nextLink:
        description: Link to retrieve next page of results.
        readOnly: true
        type: string
      value:
        description: Array of results.
        items:
          $ref: "#/definitions/DatabaseColumn"
        readOnly: true
        type: array
    type: object
  DatabaseColumnProperties:
    description: Database column properties.
    properties:
      columnType:
        description: The column data type.
        enum:
          - image
          - text
          - uniqueidentifier
          - date
          - time
          - datetime2
          - datetimeoffset
          - tinyint
          - smallint
          - int
          - smalldatetime
          - real
          - money
          - datetime
          - float
          - sql_variant
          - ntext
          - bit
          - decimal
          - numeric
          - smallmoney
          - bigint
          - hierarchyid
          - geometry
          - geography
          - varbinary
          - varchar
          - binary
          - char
          - timestamp
          - nvarchar
          - nchar
          - xml
          - sysname
        type: string
        x-ms-enum:
          modelAsString: true
          name: ColumnDataType
    type: object
  DatabaseSchema:
    allOf:
      - $ref: "#/definitions/ProxyResource"
    description: A database schema resource.
    type: object
  DatabaseSchemaListResult:
    description: A list of database schemas.
    properties:
      nextLink:
        description: Link to retrieve next page of results.
        readOnly: true
        type: string
      value:
        description: Array of results.
        items:
          $ref: "#/definitions/DatabaseSchema"
        readOnly: true
        type: array
    type: object
  DatabaseTable:
    allOf:
      - $ref: "#/definitions/ProxyResource"
    description: A database table resource.
    type: object
  DatabaseTableListResult:
    description: A list of database tables.
    properties:
      nextLink:
        description: Link to retrieve next page of results.
        readOnly: true
        type: string
      value:
        description: Array of results.
        items:
          $ref: "#/definitions/DatabaseTable"
        readOnly: true
        type: array
    type: object
  ProxyResource:
    allOf:
      - $ref: "#/definitions/Resource"
    description: ARM proxy resource.
    properties: {}
    type: object
  Resource:
    description: ARM resource.
    properties:
      id:
        description: Resource ID.
        readOnly: true
        type: string
      name:
        description: Resource name.
        readOnly: true
        type: string
      type:
        description: Resource type.
        readOnly: true
        type: string
    type: object
    x-ms-azure-resource: true
