{
  "swagger": "2.0",
  "schemes": [
    "https"
  ],
  "host": "management.azure.com",
  "info": {
    "title": "MonitorClient",
    "version": "2016-09-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/monitor/resource-manager/Microsoft.Insights/stable/2016-09-01/metrics_API.json",
        "version": "2.0"
      }
    ],
    "x-preferred": false,
    "x-providerName": "azure.com",
    "x-serviceName": "monitor-metrics_API",
    "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"
    }
  },
  "security": [
    {
      "azure_auth": [
        "user_impersonation"
      ]
    }
  ],
  "parameters": {
    "ApiVersionParameter": {
      "description": "Client Api Version.",
      "in": "query",
      "name": "api-version",
      "required": true,
      "type": "string"
    }
  },
  "paths": {
    "/{resourceUri}/providers/microsoft.insights/metrics": {
      "get": {
        "description": "Lists the metric values for a resource.",
        "operationId": "Metrics_List",
        "parameters": [
          {
            "description": "The identifier of the resource.",
            "in": "path",
            "name": "resourceUri",
            "required": true,
            "type": "string",
            "x-ms-parameter-location": "method",
            "x-ms-skip-url-encoding": true
          },
          {
            "description": "Reduces the set of data collected.<br>The filter is optional. If present it must contain a list of metric names to retrieve of the form: *(name.value eq 'metricName' [or name.value eq 'metricName' or ...])*. Optionally, the filter can contain conditions for the following attributes *aggregationType*, *startTime*, *endTime*, and *timeGrain* of the form *attributeName operator value*. Where operator is one of *ne*, *eq*, *gt*, *lt*.<br>Several conditions can be combined with parentheses and logical operators, e.g: *and*, *or*.<br>Some example filter expressions are:<br>- $filter=(name.value eq 'RunsSucceeded') and aggregationType eq 'Total' and startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq duration'PT1M',<br>- $filter=(name.value eq 'RunsSucceeded') and (aggregationType eq 'Total' or aggregationType eq 'Average') and startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq duration'PT1H',<br>- $filter=(name.value eq 'ActionsCompleted' or name.value eq 'RunsSucceeded') and (aggregationType eq 'Total' or aggregationType eq 'Average') and startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq duration'PT1M'.<br><br>**NOTE**: When a metrics query comes in with multiple metrics, but with no aggregation types defined, the service will pick the Primary aggregation type of the first metrics to be used as the default aggregation type for all the metrics.",
            "in": "query",
            "name": "$filter",
            "required": false,
            "type": "string"
          },
          {
            "$ref": "#/parameters/ApiVersionParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful request to get the list of metric values",
            "examples": {
              "application/json": {
                "value": [
                  {
                    "data": [
                      {
                        "timeStamp": "2016-11-23T19:14:00Z",
                        "total": 1
                      },
                      {
                        "timeStamp": "2016-11-23T19:15:00Z"
                      },
                      {
                        "timeStamp": "2016-11-23T19:16:00Z"
                      },
                      {
                        "timeStamp": "2016-11-23T19:17:00Z"
                      },
                      {
                        "timeStamp": "2016-11-23T19:18:00Z"
                      },
                      {
                        "timeStamp": "2016-11-23T19:19:00Z",
                        "total": 1
                      },
                      {
                        "timeStamp": "2016-11-23T19:20:00Z"
                      },
                      {
                        "timeStamp": "2016-11-23T19:21:00Z"
                      },
                      {
                        "timeStamp": "2016-11-23T19:22:00Z"
                      },
                      {
                        "timeStamp": "2016-11-23T19:23:00Z"
                      },
                      {
                        "timeStamp": "2016-11-23T19:24:00Z",
                        "total": 1
                      }
                    ],
                    "id": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/andy0802australia/providers/Microsoft.Logic/workflows/andy0803australia/providers/microsoft.insights/metrics/RunsStarted",
                    "name": {
                      "localizedValue": "Runs Started",
                      "value": "RunsStarted"
                    },
                    "type": "Microsoft.Insights/metrics",
                    "unit": "Count"
                  }
                ]
              }
            },
            "schema": {
              "$ref": "#/definitions/MetricCollection"
            }
          },
          "default": {
            "description": "Error response describing why the operation failed.",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        },
        "tags": [
          "Metrics"
        ],
        "x-ms-examples": {
          "Get Metric with filter": {
            "parameters": {
              "$filter": "(name.value eq 'RunsStarted') and aggregationType eq 'Total' and startTime eq 2016-11-23 and endTime eq 2016-11-24 and timeGrain eq duration'PT1M'",
              "api-version": "2016-09-01",
              "resourceUri": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/andy0802australia/providers/Microsoft.Logic/workflows/andy0803australia",
              "subscriptionId": "df602c9c-7aa0-407d-a6fb-eb20c8bd1192"
            },
            "responses": {
              "200": {
                "body": {
                  "value": [
                    {
                      "data": [
                        {
                          "timeStamp": "2016-11-23T19:14:00Z",
                          "total": 1
                        },
                        {
                          "timeStamp": "2016-11-23T19:15:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:16:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:17:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:18:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:19:00Z",
                          "total": 1
                        },
                        {
                          "timeStamp": "2016-11-23T19:20:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:21:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:22:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:23:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:24:00Z",
                          "total": 1
                        }
                      ],
                      "id": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/andy0802australia/providers/Microsoft.Logic/workflows/andy0803australia/providers/microsoft.insights/metrics/RunsStarted",
                      "name": {
                        "localizedValue": "Runs Started",
                        "value": "RunsStarted"
                      },
                      "type": "Microsoft.Insights/metrics",
                      "unit": "Count"
                    }
                  ]
                }
              }
            }
          },
          "Get Metric without filter": {
            "parameters": {
              "api-version": "2016-09-01",
              "resourceUri": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/andy0802australia/providers/Microsoft.Logic/workflows/andy0803australia",
              "subscriptionId": "df602c9c-7aa0-407d-a6fb-eb20c8bd1192"
            },
            "responses": {
              "200": {
                "body": {
                  "value": [
                    {
                      "data": [
                        {
                          "timeStamp": "2016-11-23T19:14:00Z",
                          "total": 1
                        },
                        {
                          "timeStamp": "2016-11-23T19:15:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:16:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:17:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:18:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:19:00Z",
                          "total": 1
                        },
                        {
                          "timeStamp": "2016-11-23T19:20:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:21:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:22:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:23:00Z"
                        },
                        {
                          "timeStamp": "2016-11-23T19:24:00Z",
                          "total": 1
                        }
                      ],
                      "id": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/andy0802australia/providers/Microsoft.Logic/workflows/andy0803australia/providers/microsoft.insights/metrics/RunsStarted",
                      "name": {
                        "localizedValue": "Runs Started",
                        "value": "RunsStarted"
                      },
                      "type": "Microsoft.Insights/metrics",
                      "unit": "Count"
                    }
                  ]
                }
              }
            }
          }
        },
        "x-ms-odata": "#/definitions/Metric",
        "x-ms-pageable": {
          "nextLinkName": null
        }
      }
    }
  },
  "definitions": {
    "ErrorResponse": {
      "description": "Describes the format of Error response.",
      "properties": {
        "code": {
          "description": "Error code",
          "type": "string"
        },
        "message": {
          "description": "Error message indicating why the operation failed.",
          "type": "string"
        }
      },
      "type": "object"
    },
    "LocalizableString": {
      "description": "The localizable string class.",
      "properties": {
        "localizedValue": {
          "description": "the locale specific value.",
          "type": "string"
        },
        "value": {
          "description": "the invariant value.",
          "type": "string"
        }
      },
      "required": [
        "value"
      ]
    },
    "Metric": {
      "description": "A set of metric values in a time range.",
      "properties": {
        "data": {
          "description": "Array of data points representing the metric values.",
          "items": {
            "$ref": "#/definitions/MetricValue"
          },
          "type": "array"
        },
        "id": {
          "description": "the id, resourceId, of the metric.",
          "type": "string"
        },
        "name": {
          "$ref": "#/definitions/LocalizableString",
          "description": "the name and the display name of the metric, i.e. it is localizable string."
        },
        "type": {
          "description": "the resource type of the metric resource.",
          "type": "string"
        },
        "unit": {
          "$ref": "#/definitions/Unit",
          "description": "the unit of the metric."
        }
      },
      "required": [
        "name",
        "unit",
        "data"
      ]
    },
    "MetricCollection": {
      "description": "The collection of metric value sets.",
      "properties": {
        "value": {
          "description": "the value of the collection.",
          "items": {
            "$ref": "#/definitions/Metric"
          },
          "type": "array"
        }
      },
      "required": [
        "value"
      ]
    },
    "MetricValue": {
      "description": "Represents a metric value.",
      "properties": {
        "average": {
          "description": "the average value in the time range.",
          "format": "double",
          "type": "number"
        },
        "count": {
          "description": "the number of samples in the time range. Can be used to determine the number of values that contributed to the average value.",
          "format": "int64",
          "type": "integer"
        },
        "maximum": {
          "description": "the greatest value in the time range.",
          "format": "double",
          "type": "number"
        },
        "minimum": {
          "description": "the least value in the time range.",
          "format": "double",
          "type": "number"
        },
        "timeStamp": {
          "description": "the timestamp for the metric value in ISO 8601 format.",
          "format": "date-time",
          "type": "string"
        },
        "total": {
          "description": "the sum of all of the values in the time range.",
          "format": "double",
          "type": "number"
        }
      },
      "required": [
        "timeStamp"
      ]
    },
    "Unit": {
      "description": "the unit of the metric.",
      "enum": [
        "Count",
        "Bytes",
        "Seconds",
        "CountPerSecond",
        "BytesPerSecond",
        "Percent",
        "MilliSeconds"
      ],
      "type": "string",
      "x-ms-enum": {
        "modelAsString": false,
        "name": "Unit"
      }
    }
  }
}