0
votes

I like to use curl to fetch data from my application insights but i'm unable to get the data from customDimensions (which contains json data). A simple query would be this one:

curl "https://api.applicationinsights.io/v1/apps/my-app-id/query?query=traces%20%7C%20project%20customDimensions" -H "x-api-key: my-api-key"

Let's assume the traces table contains 10 entries then the response would look like this:

{
  "tables": [
    {
      "name": "PrimaryResult",
      "columns": [
        {
          "name": "customDimensions",
          "type": "dynamic"
        }
      ],
      "rows": [
        [ null ],
        [ null ],
        [ null ],
        [ null ],
        [ null ],
        [ null ],
        [ null ],
        [ null ],
        [ null ],
        [ null ]
      ]
    }
  ]
}

Using the query editor in application insights in the azure portal, the same query works fine and returns the customDimensions.

Thanks in advance.

2

2 Answers

0
votes

Could you please check the application insights you used in your curl query is the same one you did in query editor in azure portal?

I test it at my side, no problem.

enter image description here

0
votes

Can you try this portal to query application insight from cURL-


https://dev.applicationinsights.io/apiexplorer/query.

In the Request tab choose cURL and in the query tab just write traces | project customDimensions. It worked for me.In that way you can be sure that querying from cURL will work.