Application Insights itself has great set of features that allows consumers to do many analysis on the application performance and monitoring. But there can be situations where you do need to find them located outside in external web applications. This is simplified by having support for different APIs and libraries to access Application Insights. In this article, we will focus on the REST API.
Sunday, February 27, 2022
Using Application Insights Rest API
Navigate to Application Insights instance and API Access tab on the left and Create an API Key. Make note of the 'Application ID' as it will be used in query string.
As our purpose is to read telemetry, we will opt just for that and generate the key.
As this is an example attempt, I will use Postman to demonstrate the POST Request on REST Api. Next step will be to setup the authorization key as a header. You need to set the application ID in the url to construct the url.
This is the simplest step if you are familiar with querying Application Insights. You can specify the Kusto Query Language (KQL) syntax in the body and get the response. Also I have setup timespan as P1D, where it defines the duration of data to be queried from.
In this example I have requested all requests, but you can look for multiple filters by constructing a WHERE query as per KQL syntax.