Metrics - Get
Retrieve metric data
Gets metric values for a single metric
GET https://api.applicationinsights.io/v1/apps/{appId}/metrics/{metricId}GET https://api.applicationinsights.io/v1/apps/{appId}/metrics/{metricId}?timespan={timespan}&interval={interval}&aggregation={aggregation}&segment={segment}&top={top}&orderby={orderby}&filter={filter}URI Parameters
| Name | In | Required | Type | Description | 
|---|---|---|---|---|
| app | path | True | string | ID of the application. This is Application ID from the API Access settings blade in the Azure portal. | 
| metric | path | True | ID of the metric. This is either a standard AI metric, or an application-specific custom metric. | |
| aggregation | query | The aggregation to use when computing the metric values. To retrieve more than one aggregation at a time, separate them with a comma. If no aggregation is specified, then the default aggregation for the metric is used. | ||
| filter | query | 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. | |
| interval | query | string (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. | |
| orderby | query | string | The aggregation function and direction to sort the segments by. This value is only valid when segment is specified. | |
| segment | query | 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. | ||
| timespan | query | string | The timespan over which to retrieve metric values. This is an ISO8601 time period value. If timespan is omitted, a default time range of  | |
| top | query | integer (int32) | The number of segments to return. This value is only valid when segment is specified. | 
Responses
| Name | Type | Description | 
|---|---|---|
| 200 OK | Successful response | |
| Other Status Codes | An error response object. | 
Security
oauth2
Connect to Azure Application Insights API
					Type: 
					oauth2
					Flow: 
					implicit
					Authorization URL: 
					https://login.microsoftonline.com/common/oauth2/authorize?resource=https%3A%2F%2Fapi.applicationinsights.io
			
Scopes
| Name | Description | 
|---|---|
| user_impersonation | impersonate your user account | 
Examples
| intervaled | 
| segmented | 
| simple | 
intervaledMetric 
			Sample request
GET https://api.applicationinsights.io/v1/apps/DEMO_APP/metrics/requests%2Fcount?timespan=P2D&interval=P1D
Sample response
{
  "value": {
    "start": "2018-02-04T10:01:35.086Z",
    "end": "2018-02-06T10:01:35.086Z",
    "interval": "P1D",
    "segments": [
      {
        "start": "2018-02-04T10:01:35.086Z",
        "end": "2018-02-05T00:00:00.000Z",
        "requests/count": {
          "sum": 4927
        }
      },
      {
        "start": "2018-02-05T00:00:00.000Z",
        "end": "2018-02-06T00:00:00.000Z",
        "requests/count": {
          "sum": 8460
        }
      },
      {
        "start": "2018-02-06T00:00:00.000Z",
        "end": "2018-02-06T10:01:35.086Z",
        "requests/count": {
          "sum": 3743
        }
      }
    ]
  }
}segmentedIntervaledMetric  
			Sample request
GET https://api.applicationinsights.io/v1/apps/DEMO_APP/metrics/requests%2Fcount?timespan=P2D&interval=P1D&segment=operation/name,request/success
Sample response
{
  "value": {
    "start": "2018-10-22T10:40:09.065Z",
    "end": "2018-10-22T22:40:09.065Z",
    "segments": [
      {
        "operation/name": "GET Home/Index",
        "segments": [
          {
            "requests/count": null,
            "sum": 156483,
            "request/success": false
          },
          {
            "requests/count": null,
            "sum": 3795,
            "request/success": true
          }
        ]
      },
      {
        "operation/name": "GET /",
        "segments": [
          {
            "requests/count": null,
            "sum": 34168,
            "request/success": false
          },
          {
            "requests/count": null,
            "sum": 12,
            "request/success": true
          }
        ]
      },
      {
        "operation/name": "GET /FabrikamProd/Content/fonts/segoewp-light-webfont.eot",
        "segments": [
          {
            "requests/count": null,
            "sum": 9378,
            "request/success": true
          }
        ]
      },
      {
        "operation/name": "GET /FabrikamProd/Content/fonts/segoewp-webfont.eot",
        "segments": [
          {
            "requests/count": null,
            "sum": 9370,
            "request/success": true
          }
        ]
      },
      {
        "operation/name": "GET ServiceTickets/Details",
        "segments": [
          {
            "requests/count": null,
            "sum": 1989,
            "request/success": false
          },
          {
            "requests/count": null,
            "sum": 14,
            "request/success": true
          }
        ]
      },
      {
        "operation/name": "GET ServiceTickets/Index",
        "segments": [
          {
            "requests/count": null,
            "sum": 1991,
            "request/success": true
          }
        ]
      },
      {
        "operation/name": "GET Employees/Index",
        "segments": [
          {
            "requests/count": null,
            "sum": 1990,
            "request/success": true
          }
        ]
      },
      {
        "operation/name": "GET ServiceTickets/GetLogEntries",
        "segments": [
          {
            "requests/count": null,
            "sum": 1985,
            "request/success": true
          }
        ]
      },
      {
        "operation/name": "GET Employees/Details",
        "segments": [
          {
            "requests/count": null,
            "sum": 663,
            "request/success": false
          },
          {
            "requests/count": null,
            "sum": 663,
            "request/success": true
          }
        ]
      },
      {
        "operation/name": "GET Reports/Index",
        "segments": [
          {
            "requests/count": null,
            "sum": 1086,
            "request/success": true
          }
        ]
      }
    ]
  }
}simpleMetric 
			Sample request
GET https://api.applicationinsights.io/v1/apps/DEMO_APP/metrics/requests%2Fcount
Sample response
{
  "value": {
    "start": "2016-01-01T02:00:00.000Z",
    "end": "2016-01-03T02:00:00.000Z",
    "requests/count": {
      "sum": 23
    }
  }
}Definitions
| Name | Description | 
|---|---|
| error | Error details. | 
| error | The code and message for an error. | 
| error | Error details. | 
| Metric | ID of the metric. This is either a standard AI metric, or an application-specific custom metric. | 
| Metrics | The aggregation to use when computing the metric values. To retrieve more than one aggregation at a time, separate them with a comma. If no aggregation is specified, then the default aggregation for the metric is used. | 
| metrics | A metric result. | 
| metrics | A metric result data. | 
| Metrics | 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. | 
| metrics | A metric segment | 
errorDetail 
			
			Error details.
| Name | Type | Description | 
|---|---|---|
| additionalProperties | object | |
| code | string | The error's code. | 
| message | string | A human readable error message. | 
| resources | string[] | Indicates resources which were responsible for the error. | 
| target | string | Indicates which property in the request is responsible for the error. | 
| value | string | Indicates which value in 'target' is responsible for the error. | 
errorInfo 
			
			The code and message for an error.
| Name | Type | Description | 
|---|---|---|
| additionalProperties | object | |
| code | string | A machine readable error code. | 
| details | error details. | |
| innererror | The code and message for an error. | |
| message | string | A human readable error message. | 
errorResponse 
			
			Error details.
| Name | Type | Description | 
|---|---|---|
| error | The code and message for an error. | 
MetricId 
			
			ID of the metric. This is either a standard AI metric, or an application-specific custom metric.
| Value | Description | 
|---|---|
| requests/count | |
| requests/duration | |
| requests/failed | |
| users/count | |
| users/authenticated | |
| pageViews/count | |
| pageViews/duration | |
| client/processingDuration | |
| client/receiveDuration | |
| client/networkDuration | |
| client/sendDuration | |
| client/totalDuration | |
| dependencies/count | |
| dependencies/failed | |
| dependencies/duration | |
| exceptions/count | |
| exceptions/browser | |
| exceptions/server | |
| sessions/count | |
| performanceCounters/requestExecutionTime | |
| performanceCounters/requestsPerSecond | |
| performanceCounters/requestsInQueue | |
| performanceCounters/memoryAvailableBytes | |
| performanceCounters/exceptionsPerSecond | |
| performanceCounters/processCpuPercentage | |
| performanceCounters/processIOBytesPerSecond | |
| performanceCounters/processPrivateBytes | |
| performanceCounters/processorCpuPercentage | |
| availabilityResults/availabilityPercentage | |
| availabilityResults/duration | |
| billing/telemetryCount | |
| customEvents/count | 
MetricsAggregation 
			
			The aggregation to use when computing the metric values. To retrieve more than one aggregation at a time, separate them with a comma. If no aggregation is specified, then the default aggregation for the metric is used.
| Value | Description | 
|---|---|
| min | |
| max | |
| avg | |
| sum | |
| count | |
| unique | 
metricsResult 
			
			A metric result.
| Name | Type | Description | 
|---|---|---|
| value | A metric result data. | 
metricsResultInfo  
			
			A metric result data.
| Name | Type | Description | 
|---|---|---|
| end | string (date_time) | Start time of the metric. | 
| interval | string (duration) | The interval used to segment the metric data. | 
| segments | Segmented metric data (if segmented). | |
| start | string (date_time) | Start time of the metric. | 
MetricsSegment 
			
			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.
| Value | Description | 
|---|---|
| applicationBuild | |
| applicationVersion | |
| authenticatedOrAnonymousTraffic | |
| browser | |
| browserVersion | |
| city | |
| cloudRoleName | |
| cloudServiceName | |
| continent | |
| countryOrRegion | |
| deploymentId | |
| deploymentUnit | |
| deviceType | |
| environment | |
| hostingLocation | |
| instanceName | 
metricsSegmentInfo  
			
			A metric segment
| Name | Type | Description | 
|---|---|---|
| end | string (date_time) | Start time of the metric segment (only when an interval was specified). | 
| segments | Segmented metric data (if further segmented). | |
| start | string (date_time) | Start time of the metric segment (only when an interval was specified). |