user1354825
user1354825

Reputation: 1541

Execute AppInsight query via REST API

I am looking for a feature where i can fire appinsight query via REST API.

I am currently scanning logs using the query executor as shown below..

traces
| where message contains "something"
| order by timestamp desc

I want to integrate this with my REST application so that i don't have to login to appinsight and execute this query manually.

Is there an API available , that exposes such a feature where i can dynamically pass a query / execute a stored(custom) query and get the output as response?

Upvotes: 0

Views: 386

Answers (1)

Ivan Glasenberg
Ivan Glasenberg

Reputation: 30025

Update: how to construct the query url:

You need to get the Application Id and API key, then use them to build your query url.

Step 1: Get Application Id. Nav to azure portal -> your application insights -> API Access. then you can see the Application Id:

enter image description here

Step 2: then click the "Create API key" button, in the new page, do something as per the screenshot below -> then click the "Generate key" button:

enter image description here

Step 3: in the new page, copy and save the API key:

enter image description here

Step 4: then go to this link -> fill in all the necessary information -> then in the right pane, you can see it auto generates a url. Screenshot as below:

enter image description here


Original:

Yes, you can use the application insights get-query api.

For how to use this api, please refer to this quickstart for more details.

Please let me know if you still have more issues.

Upvotes: 1

Related Questions