Our service writes a lot of custom events and metrics to App Insights. Using the AI portal we can make complex queries and see nice charts, but I would like to access the data from outside the portal. The Azure Application Insights REST API page (https://dev.applicationinsights.io) claims that those API can be used to perform such task, but I am unable to make them work - again I want to query custom events and metrics, not the standard ones. Does anyone have any examples? Here is for example one our queries:
customEvents
| where name startswith "Monitor.Xxxxxxx"
| summarize count() by bin(timestamp, 1min)
| order by timestamp desc