Forum Discussion
log analytics API returning empty Table collection
- Jul 04, 2019
After much bashing of the head against the desk, it would seem that not all the queries that work in the Log Analytics web engine work through the API. My previous errors were being masked by the JSON not converting properly and being left out of the body. Fiddler ftw!
If I use "search Operation == 'desired op'" and pass it into the body of the POST then that works ok and results are returned.
After much bashing of the head against the desk, it would seem that not all the queries that work in the Log Analytics web engine work through the API. My previous errors were being masked by the JSON not converting properly and being left out of the body. Fiddler ftw!
If I use "search Operation == 'desired op'" and pass it into the body of the POST then that works ok and results are returned.
- niukkNov 15, 2019Copper Contributor
Paul Hunt - Cimares I got the same, trying simple query 'Heartbeat| limit 50' which gets me empty table. How do I pass "search Operation == 'desired op'" into the body ? Thnx
- ktvasanhotmailcomDec 02, 2021Copper ContributorI had same problem, Instead of posting query as json just append the query string in the url
like:
url = "https://api.loganalytics.io/v1/workspaces/"+ workspace_id + "/query?query=AzureActivity | summarize count() by Category" - caractacusSep 15, 2021Copper Contributor
niukk in my case, it was a missing "Content-Type: application/json" header.
Once the request header was added, data was returned.