Moustafa
Moustafa

Reputation: 145

Application Insights response code 400 Bad request

when trying to call application insights api service with this url it gave me 400 Bad request

https://api.applicationinsights.io/beta/apps/appID/events/pageViews?timespan=P30D&$filter=contains(pageView/url,'valid-url')&$count=true

appID and valid-url is set correctly and i delete them in this question to make it more easy to read

Is there any issue in using $filter=contains ???

Upvotes: 0

Views: 2909

Answers (1)

John Gardner
John Gardner

Reputation: 25106

the easiest way to verify this stuff is to use the api explorer, and the demo app:

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

this url shows that startswith works fine:

https://dev.applicationinsights.io/apiexplorer/events?appId=DEMO_APP&apiKey=DEMO_KEY&eventType=pageViews&timespan=P30D&$filter=startswith(pageView%2Furl%2C'http%3A%2F%2Faiconnect')

if you "need" something like contains, you can use $search (which looks across most fields, though, and has its own AND/OR text search logic)

https://dev.applicationinsights.io/apiexplorer/events?appId=DEMO_APP&apiKey=DEMO_KEY&eventType=pageViews&timespan=P30D&$search=%22Customers%2FCreate%22

Upvotes: 2

Related Questions