Execute OData query

Executes an OData query for events

HTTP request

GET /v1/apps/{appId}/events/{eventType}

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
appId string

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

eventType string

The type of events to query; either a standard event type (traces, customEvents, pageViews, requests, dependencies, exceptions, availabilityResults) or $all to query across all event types.

Query parameters

Name Value Description
timespan string (interval)

Optional. The timespan over which to retrieve events. This is an ISO8601 time period value. This timespan is applied in addition to any that are specified in the Odata expression.

$filter string

An expression used to filter the returned events

$search string

A free-text search expression to match for whether a particular event should be returned

$orderby string

A comma-separated list of properties with "asc" (the default) or "desc" to control the order of returned events

$select string

Limits the properties to just those requested on each returned event

$skip integer (int32)

The number of items to skip over before returning events

$top integer (int32)

The number of events to return

$format string

Format for the returned events

$count boolean

Request a count of matching items included with the returned events

$apply string

An expression used for aggregation over returned events

Responses

Status Code Description
200 Successful response
400 Bad Request. The request was invalid; can be caused by a bad API request body, or errors in the Analytics query in the request
401 Unauthorized. No authentication was provided; authenticate and re-issue the API call
402 Payment required (the app is not in a required pricing tier)
403 Forbidden. Authentication was provided, but the caller did not have the necessary permissions
404 Invalid appId or eventId
429 Too many requests
500 Internal Server Error. The service experienced an unexpected error while processing the request
502 Bad Gateway. A downstream service dependency experienced an internal service error while processing the request
503 Service unavailable
504 Gateway Timeout. A downstream service dependency timed out while processing the request

Examples


Gets events of a specific type

Parameters:

{
  "appId": "DEMO_APP",
  "eventType": "traces",
  "event-top": 5
}

Response:

{
  "body": {
    "@odata.context": "https://api.applicationinsights.io/v1/apps/DEMO_APP/events/$metadata#traces",
    "@ai.messages": [
      {
        "code": "AddedLimitToQuery",
        "message": "The query was limited to last 12 hours, since no other limit for timestamp field was specified"
      }
    ],
    "value": [
      {
        "id": "dc76df01-0141-11e8-9894-e3e7c1eeabad",
        "type": "trace",
        "count": 1,
        "timestamp": "2018-01-24T20:04:32.243Z",
        "customDimensions": null,
        "customMeasurements": null,
        "operation": {
          "name": "GET /FabrikamProd/Employees/Create",
          "id": "HPFy1bNlyQ0=",
          "parentId": "|HPFy1bNlyQ0=.c642e1f1_",
          "syntheticSource": "Application Insights Availability Monitoring"
        },
        "session": {
          "id": "97915c9e-2ba3-4258-82f5-84233de21127"
        },
        "user": {
          "id": "emea-ru-msa-edge_97915c9e-2ba3-4258-82f5-84233de21127",
          "accountId": null,
          "authenticatedId": null
        },
        "cloud": {
          "roleName": "",
          "roleInstance": "AIConnect2"
        },
        "ai": {
          "iKey": "5a2e4e0c-e136-4a15-9824-90ba859b0a89",
          "appName": "fabrikamprod",
          "appId": "cf58dcfd-0683-487c-bc84-048789bca8e5",
          "sdkVersion": "sd:2.4.1-442"
        },
        "trace": {
          "message": "New Request Received",
          "severityLevel": 0
        },
        "application": {
          "version": ""
        },
        "client": {
          "model": null,
          "os": null,
          "type": "PC",
          "browser": null,
          "ip": "51.140.105.0",
          "city": "London",
          "stateOrProvince": "England",
          "countryOrRegion": "United Kingdom"
        }
      },
      {
        "id": "ca54b09b-0141-11e8-8c76-4de3c2c29f12",
        "type": "trace",
        "count": 1,
        "timestamp": "2018-01-24T20:04:22.799Z",
        "customDimensions": null,
        "customMeasurements": null,
        "operation": {
          "name": "GET /FabrikamProd/Employees/Create",
          "id": "fYhtYFzAYv4=",
          "parentId": "|fYhtYFzAYv4=.c642e1f0_",
          "syntheticSource": "Application Insights Availability Monitoring"
        },
        "session": {
          "id": "e0aca036-2ef0-4c41-adb9-5875625901ee"
        },
        "user": {
          "id": "us-fl-mia-edge_e0aca036-2ef0-4c41-adb9-5875625901ee",
          "accountId": null,
          "authenticatedId": null
        },
        "cloud": {
          "roleName": "",
          "roleInstance": "AIConnect2"
        },
        "ai": {
          "iKey": "5a2e4e0c-e136-4a15-9824-90ba859b0a89",
          "appName": "fabrikamprod",
          "appId": "cf58dcfd-0683-487c-bc84-048789bca8e5",
          "sdkVersion": "sd:2.4.1-442"
        },
        "trace": {
          "message": "New Request Received",
          "severityLevel": 0
        },
        "application": {
          "version": ""
        },
        "client": {
          "model": null,
          "os": null,
          "type": "PC",
          "browser": null,
          "ip": "52.173.244.0",
          "city": "Des Moines",
          "stateOrProvince": "Iowa",
          "countryOrRegion": "United States"
        }
      },
      {
        "id": "caf07b61-0141-11e8-bb21-bb0d564a046f",
        "type": "trace",
        "count": 1,
        "timestamp": "2018-01-24T20:04:02.106Z",
        "customDimensions": null,
        "customMeasurements": null,
        "operation": {
          "name": "GET /",
          "id": "EfIqgW6eLWQ=",
          "parentId": "|EfIqgW6eLWQ=.1eb73a79_",
          "syntheticSource": "Application Insights Availability Monitoring"
        },
        "session": {
          "id": "323ab959-4c64-4de4-95e9-04334fbd7749"
        },
        "user": {
          "id": "apac-hk-hkn-azr_323ab959-4c64-4de4-95e9-04334fbd7749",
          "accountId": null,
          "authenticatedId": null
        },
        "cloud": {
          "roleName": "fabrikamfiberapp",
          "roleInstance": "RD00155D467E8D"
        },
        "ai": {
          "iKey": "5a2e4e0c-e136-4a15-9824-90ba859b0a89",
          "appName": "fabrikamprod",
          "appId": "cf58dcfd-0683-487c-bc84-048789bca8e5",
          "sdkVersion": "sd:2.4.1-442"
        },
        "trace": {
          "message": "New Request Received",
          "severityLevel": 0
        },
        "application": {
          "version": "AutoGen_49c3aea0-4641-4675-93b5-55f7a62d22d3"
        },
        "client": {
          "model": null,
          "os": null,
          "type": "PC",
          "browser": null,
          "ip": "52.175.39.0",
          "city": "Hong Kong",
          "stateOrProvince": "Central and Western District",
          "countryOrRegion": "Hong Kong"
        }
      },
      {
        "id": "b8599222-0141-11e8-99cf-07437267f251",
        "type": "trace",
        "count": 1,
        "timestamp": "2018-01-24T20:03:55.554Z",
        "customDimensions": null,
        "customMeasurements": null,
        "operation": {
          "name": "GET /",
          "id": "7j5dSPYFB5A=",
          "parentId": "|7j5dSPYFB5A=.1eb73a78_",
          "syntheticSource": "Application Insights Availability Monitoring"
        },
        "session": {
          "id": "b82a2630-5598-4291-a3db-976117f07490"
        },
        "user": {
          "id": "us-il-ch1-azr_b82a2630-5598-4291-a3db-976117f07490",
          "accountId": null,
          "authenticatedId": null
        },
        "cloud": {
          "roleName": "fabrikamfiberapp",
          "roleInstance": "RD00155D467E8D"
        },
        "ai": {
          "iKey": "5a2e4e0c-e136-4a15-9824-90ba859b0a89",
          "appName": "fabrikamprod",
          "appId": "cf58dcfd-0683-487c-bc84-048789bca8e5",
          "sdkVersion": "sd:2.4.1-442"
        },
        "trace": {
          "message": "New Request Received",
          "severityLevel": 0
        },
        "application": {
          "version": "AutoGen_49c3aea0-4641-4675-93b5-55f7a62d22d3"
        },
        "client": {
          "model": null,
          "os": null,
          "type": "PC",
          "browser": null,
          "ip": "52.237.156.0",
          "city": "Chicago",
          "stateOrProvince": "Illinois",
          "countryOrRegion": "United States"
        }
      },
      {
        "id": "b8599221-0141-11e8-99cf-07437267f251",
        "type": "trace",
        "count": 1,
        "timestamp": "2018-01-24T20:03:37.437Z",
        "customDimensions": null,
        "customMeasurements": null,
        "operation": {
          "name": "GET /",
          "id": "xoAJ+fhhQQE=",
          "parentId": "|xoAJ+fhhQQE=.1eb73a77_",
          "syntheticSource": "Application Insights Availability Monitoring"
        },
        "session": {
          "id": "b2066202-e8cd-47de-8c4c-d4d55f3653a4"
        },
        "user": {
          "id": "emea-ru-msa-edge_b2066202-e8cd-47de-8c4c-d4d55f3653a4",
          "accountId": null,
          "authenticatedId": null
        },
        "cloud": {
          "roleName": "fabrikamfiberapp",
          "roleInstance": "RD00155D467E8D"
        },
        "ai": {
          "iKey": "5a2e4e0c-e136-4a15-9824-90ba859b0a89",
          "appName": "fabrikamprod",
          "appId": "cf58dcfd-0683-487c-bc84-048789bca8e5",
          "sdkVersion": "sd:2.4.1-442"
        },
        "trace": {
          "message": "New Request Received",
          "severityLevel": 0
        },
        "application": {
          "version": "AutoGen_49c3aea0-4641-4675-93b5-55f7a62d22d3"
        },
        "client": {
          "model": null,
          "os": null,
          "type": "PC",
          "browser": null,
          "ip": "51.140.79.0",
          "city": "London",
          "stateOrProvince": "England",
          "countryOrRegion": "United Kingdom"
        }
      }
    ]
  }
}