Azure SQL Database icon

Azure SQL Database

Provides create, read, update and delete functionality for Azure SQL Database resources including servers, databases, elastic pools, recommendations, operations, and usage metrics

COMMUNITYBEARER0 INSTALLS
OpenAPI Specificationv3.0
{
  "swagger": "2.0",
  "schemes": [
    "https"
  ],
  "host": "management.azure.com",
  "info": {
    "description": "Provides create, read, update and delete functionality for Azure SQL Database resources including servers, databases, elastic pools, recommendations, operations, and usage metrics.",
    "title": "Azure SQL Database",
    "version": "2014-04-01",
    "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/stable/2014-04-01/queries.json",
        "version": "2.0"
      }
    ],
    "x-providerName": "azure.com",
    "x-serviceName": "sql-queries",
    "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": {
    "DatabaseNameParameter": {
      "description": "The name of the database.",
      "in": "path",
      "name": "databaseName",
      "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"
    }
  },
  "paths": {
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/topQueries": {
      "get": {
        "description": "Gets a list of top queries by database.",
        "operationId": "Queries_ListByDatabase",
        "parameters": [
          {
            "description": "The API version to use for the request.",
            "in": "query",
            "name": "api-version",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "client"
          },
          {
            "description": "The subscription ID that identifies an Azure subscription.",
            "in": "path",
            "name": "subscriptionId",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "client"
          },
          {
            "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"
          },
          {
            "$ref": "#/parameters/ServerNameParameter"
          },
          {
            "$ref": "#/parameters/DatabaseNameParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/TopQueriesListResult"
            }
          }
        },
        "tags": [
          "Queries"
        ],
        "x-ms-examples": {
          "List top queries": {
            "parameters": {
              "api-version": "2014-04-01",
              "databaseName": "db1",
              "resourceGroupName": "group1",
              "serverName": "sqlcrudtest",
              "subscriptionId": "00000000-1111-2222-3333-444444444444"
            },
            "responses": {
              "200": {
                "body": {
                  "value": [
                    {
                      "aggregationFunction": "sum",
                      "executionType": "any",
                      "intervalType": "PT1H",
                      "numberOfTopQueries": 1,
                      "observationEndTime": "2017-07-12T16:21:54.0916567Z",
                      "observationStartTime": "2017-07-11T16:21:54.0916567Z",
                      "observedMetric": "cpu",
                      "queries": [
                        {
                          "intervals": [
                            {
                              "executionCount": 12,
                              "intervalStartTime": "2017-07-11T16:00:00",
                              "metrics": [
                                {
                                  "displayName": "Cpu",
                                  "name": "cpu",
                                  "unit": "percentage",
                                  "value": 0.000763888888888889
                                },
                                {
                                  "displayName": "Physical Io Reads",
                                  "name": "io",
                                  "unit": "percentage",
                                  "value": 0
                                },
                                {
                                  "displayName": "Log Writes",
                                  "name": "logIo",
                                  "unit": "percentage",
                                  "value": 0
                                },
                                {
                                  "displayName": "Memory consumption",
                                  "name": "memory",
                                  "unit": "KB",
                                  "value": 0
                                },
                                {
                                  "displayName": "Query duration",
                                  "name": "duration",
                                  "unit": "microseconds",
                                  "value": 3308
                                }
                              ]
                            }
                          ],
                          "queryId": "19"
                        }
                      ],
                      "type": "Microsoft.Sql/servers/databases/topQueries"
                    }
                  ]
                }
              }
            }
          }
        },
        "x-ms-pageable": {
          "nextLinkName": null
        }
      }
    },
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/topQueries/{queryId}/queryText": {
      "get": {
        "description": "Gets a query's text.",
        "operationId": "QueryTexts_ListByQuery",
        "parameters": [
          {
            "description": "The API version to use for the request.",
            "in": "query",
            "name": "api-version",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "client"
          },
          {
            "description": "The subscription ID that identifies an Azure subscription.",
            "in": "path",
            "name": "subscriptionId",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "client"
          },
          {
            "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"
          },
          {
            "$ref": "#/parameters/ServerNameParameter"
          },
          {
            "$ref": "#/parameters/DatabaseNameParameter"
          },
          {
            "description": "The id of the query",
            "in": "path",
            "name": "queryId",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/QueryTextListResult"
            }
          }
        },
        "tags": [
          "Queries"
        ],
        "x-ms-examples": {
          "Get a query": {
            "parameters": {
              "api-version": "2014-04-01",
              "databaseName": "db1",
              "queryId": "19",
              "resourceGroupName": "group1",
              "serverName": "sqlcrudtest",
              "subscriptionId": "00000000-1111-2222-3333-444444444444"
            },
            "responses": {
              "200": {
                "body": {
                  "value": [
                    {
                      "name": "current",
                      "queryText": "select 1",
                      "type": "Microsoft.Sql/servers/databases/topQueries/queryText"
                    }
                  ]
                }
              }
            }
          }
        },
        "x-ms-pageable": {
          "nextLinkName": null
        }
      }
    },
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/topQueries/{queryId}/statistics": {
      "get": {
        "description": "Lists a query's statistics.",
        "operationId": "QueryStatistics_ListByQuery",
        "parameters": [
          {
            "description": "The API version to use for the request.",
            "in": "query",
            "name": "api-version",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "client"
          },
          {
            "description": "The subscription ID that identifies an Azure subscription.",
            "in": "path",
            "name": "subscriptionId",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "client"
          },
          {
            "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"
          },
          {
            "$ref": "#/parameters/ServerNameParameter"
          },
          {
            "$ref": "#/parameters/DatabaseNameParameter"
          },
          {
            "description": "The id of the query",
            "in": "path",
            "name": "queryId",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/QueryStatisticListResult"
            }
          }
        },
        "tags": [
          "Queries"
        ],
        "x-ms-examples": {
          "Get a query": {
            "parameters": {
              "api-version": "2014-04-01",
              "databaseName": "db1",
              "queryId": "19",
              "resourceGroupName": "group1",
              "serverName": "sqlcrudtest",
              "subscriptionId": "00000000-1111-2222-3333-444444444444"
            },
            "responses": {
              "200": {
                "body": {
                  "value": [
                    {
                      "intervals": [
                        {
                          "executionCount": 12,
                          "intervalStartTime": "2017-07-11T16:00:00",
                          "metrics": [
                            {
                              "displayName": "Cpu",
                              "name": "cpu",
                              "unit": "percentage",
                              "value": 0.000763888888888889
                            },
                            {
                              "displayName": "Physical Io Reads",
                              "name": "io",
                              "unit": "percentage",
                              "value": 0
                            },
                            {
                              "displayName": "Log Writes",
                              "name": "logIo",
                              "unit": "percentage",
                              "value": 0
                            },
                            {
                              "displayName": "Memory consumption",
                              "name": "memory",
                              "unit": "KB",
                              "value": 0
                            },
                            {
                              "displayName": "Query duration",
                              "name": "duration",
                              "unit": "microseconds",
                              "value": 3308
                            }
                          ]
                        }
                      ],
                      "queryId": "19"
                    }
                  ]
                }
              }
            }
          }
        },
        "x-ms-pageable": {
          "nextLinkName": null
        }
      }
    }
  },
  "definitions": {
    "QueryInterval": {
      "description": "A database query.",
      "properties": {
        "executionCount": {
          "description": "The number of times the query was executed during this interval.",
          "format": "int32",
          "readOnly": true,
          "type": "number"
        },
        "intervalStartTime": {
          "description": "The start time of the measurement interval (ISO8601 format).",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "metrics": {
          "description": "The list of query metrics during this interval.",
          "items": {
            "$ref": "#/definitions/QueryMetric"
          },
          "readOnly": true,
          "type": "array"
        }
      }
    },
    "QueryMetric": {
      "description": "A database query.",
      "properties": {
        "displayName": {
          "description": "The name of the metric for display in user interface",
          "readOnly": true,
          "type": "string"
        },
        "name": {
          "description": "The name of the metric",
          "readOnly": true,
          "type": "string"
        },
        "unit": {
          "description": "The unit of measurement",
          "enum": [
            "percentage",
            "KB",
            "microseconds"
          ],
          "readOnly": true,
          "type": "string",
          "x-ms-enum": {
            "modelAsString": false,
            "name": "QueryMetricUnit"
          }
        },
        "value": {
          "description": "The measured value",
          "format": "double",
          "readOnly": true,
          "type": "number"
        }
      }
    },
    "QueryStatistic": {
      "description": "A database query.",
      "properties": {
        "intervals": {
          "description": "The list of query intervals.",
          "items": {
            "$ref": "#/definitions/QueryInterval"
          },
          "readOnly": true,
          "type": "array"
        },
        "queryId": {
          "description": "The id of the query",
          "readOnly": true,
          "type": "string"
        }
      }
    },
    "QueryStatisticListResult": {
      "description": "Represents the response to a get query request.",
      "properties": {
        "value": {
          "description": "The query.",
          "items": {
            "$ref": "#/definitions/QueryStatistic"
          },
          "type": "array"
        }
      },
      "required": [
        "value"
      ]
    },
    "QueryText": {
      "properties": {
        "name": {
          "description": "Resource name.",
          "readOnly": true,
          "type": "string"
        },
        "queryText": {
          "description": "Query text.",
          "readOnly": true,
          "type": "string"
        },
        "type": {
          "description": "Resource type.",
          "readOnly": true,
          "type": "string"
        }
      }
    },
    "QueryTextListResult": {
      "description": "Represents the response to a get query text request.",
      "properties": {
        "value": {
          "description": "The query text.",
          "items": {
            "$ref": "#/definitions/QueryText"
          },
          "type": "array"
        }
      },
      "required": [
        "value"
      ]
    },
    "TopQueries": {
      "description": "A database query.",
      "properties": {
        "aggregationFunction": {
          "description": "The function that is used to aggregate each query's metrics.",
          "enum": [
            "min",
            "max",
            "avg",
            "sum"
          ],
          "readOnly": true,
          "type": "string",
          "x-ms-enum": {
            "modelAsString": false,
            "name": "QueryAggregationFunction"
          }
        },
        "executionType": {
          "description": "The execution type that is used to filter the query instances that are returned.",
          "enum": [
            "any",
            "regular",
            "irregular",
            "aborted",
            "exception"
          ],
          "readOnly": true,
          "type": "string",
          "x-ms-enum": {
            "modelAsString": false,
            "name": "QueryExecutionType"
          }
        },
        "intervalType": {
          "description": "The duration of the interval (ISO8601 duration format).",
          "readOnly": true,
          "type": "string"
        },
        "numberOfTopQueries": {
          "description": "The number of requested queries.",
          "format": "int32",
          "readOnly": true,
          "type": "number"
        },
        "observationEndTime": {
          "description": "The end time for queries that are returned (ISO8601 format)",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "observationStartTime": {
          "description": "The start time for queries that are returned (ISO8601 format)",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "observedMetric": {
          "description": "The type of metric to use for ordering the top metrics.",
          "enum": [
            "cpu",
            "io",
            "logio",
            "duration",
            "executionCount"
          ],
          "readOnly": true,
          "type": "string",
          "x-ms-enum": {
            "modelAsString": false,
            "name": "QueryObservedMetricType"
          }
        },
        "queries": {
          "description": "The list of queries.",
          "items": {
            "$ref": "#/definitions/QueryStatistic"
          },
          "readOnly": true,
          "type": "array"
        }
      }
    },
    "TopQueriesListResult": {
      "description": "Represents the response to a get top queries request.",
      "properties": {
        "value": {
          "description": "The list of top queries.",
          "items": {
            "$ref": "#/definitions/TopQueries"
          },
          "type": "array"
        }
      },
      "required": [
        "value"
      ]
    }
  }
}