Retrieve metric data

Gets metric values for a single metric

HTTP request

GET /v1/apps/{app-id}/metrics/{metric-id}

Security

Type Description
API key

Pass the API key via an X-Api-Key custom header or an api_key query parameter. [More info about authorization]

Basic Auth

Use the API key as either username or password with normal HTTP basic auth [More info about authorization]

Azure AAD Auth

Pass the AAD auth token in the 'Authorization' header. [More info about authorization]

URL parameters

Name Value Description
app-id string (uuid)

ID of the application. This is Application ID from the API Access settings blade in the Azure portal.

metric-id string

ID of the metric. This is either a standard AI metric, or an application-specific custom metric.

Query parameters

Name Value Description
timespan string (date-time-period)

The timespan over which to retrieve metric values. This is an ISO8601 time period value. If timespan is omitted, a default time range of PT12H ("last 12 hours") is used. The actual timespan that is queried may be adjusted by the server based. In all cases, the actual time span used for the query is included in the response.

interval string (time-duration)

The time interval to use when retrieving metric values. This is an ISO8601 duration. If interval is omitted, the metric value is aggregated across the entire timespan. If interval is supplied, the server may adjust the interval to a more appropriate size based on the timespan used for the query. In all cases, the actual interval used for the query is included in the response.

aggregation string (date-time-period)

The timespan over which to retrieve metric values. This is an ISO8601 time period value. If timespan is omitted, a default time range of PT12H ("last 12 hours") is used. The actual timespan that is queried may be adjusted by the server based. In all cases, the actual time span used for the query is included in the response.

segment array (csv)

The name of the dimension to segment the metric values by. This dimension must be applicable to the metric you are retrieving. To segment by more than one dimension at a time, separate them with a comma (,). In this case, the metric data will be segmented in the order the dimensions are listed in the parameter.

top integer (int32)

The number of segments to return. This value is only valid when segment is specified.

orderby string

The aggregation function and direction to sort the segments by. This value is only valid when segment is specified.

filter string

An expression used to filter the results. This value should be a valid OData filter expression where the keys of each clause should be applicable dimensions for the metric you are retrieving.

Responses

Status Code Description
200 Successful response
402 Payment required (the app is not in a required pricing tier)
404 Invalid app-id or metric-id
429 Too many requests
503 Service unavailable

Examples


Gets data for a metric.

Parameters:

{
  "app-id": "DEMO_APP",
  "metric-id": "requests/failed",
  "timespan": "P2D",
  "interval": "P1D"
}

Response:

{
  "body": {
    "value": [
      {
        "start": "2016-01-01T02:00:00.000Z",
        "end": "2016-01-03T02:00:00.000Z",
        "interval": "P1D",
        "segments": [
          {
            "start": "2016-01-01T02:00:00.000Z",
            "end": "2016-01-02T02:00:00.000Z",
            "requests/failed": {
              "sum": 23
            }
          },
          {
            "start": "2016-01-02T02:00:00.000Z",
            "end": "2016-01-03T02:00:00.000Z",
            "requests/failed": {
              "sum": 19
            }
          }
        ]
      }
    ]
  }
}