@Dino @Anil Sagar @ Google @Siddharth Barahalikar
I was working on getting stats data using Management APIS
Call made using POSTMAN:
https://{host}/v1/organizations/{abc}/environments/{xyz}/stats/apiproxy?select=sum(message_count)&timeRange=01/16/2019%2000:00~2/01/2019%2000:00&timeUnit=month&filter=(apiproxy%20like%20'abc%')&limit=14400
Got the response which i expected
Call made using BROWSERS:
https://{host}/v1/organizations/{abc}/environments/{xyz}/stats/apiproxy?select=sum(message_count)&timeRange=01/16/2019%2000:00~2/01/2019%2000:00&timeUnit=month&filter=(apiproxy%20like%20'abc%')&limit=14400
500 internal server...i analyzed a lot and i finally found fault with using like Operator
Would anyone please help me with this?
Thanks in advance
Solved! Go to Solution.
I think that the last percent char '%' should be url-encoded in your like clause. If not, this could be the reason why you get a 500 error.
Did you try something like this :
https://{host}/v1/organizations/{abc}/environments/{xyz}/stats/apiproxy?select=sum(message_count)&timeRange=01/16/2019%2000:00~2/01/2019%2000:00&timeUnit=month&filter=(apiproxy%20like%20'abc%25')&limit=14400
(but it doesn't explain why it works with Postman)
How are you adding/sending the Authorization header from Browser?
Even without the header you should be getting 401.
Is this a OPDK instance?
Thanks for the response @Siddharth Barahalikar
Call made using BROWSERS:
https://{host}/v1/organizations/{abc}/environments/{xyz}/stats/apiproxy?select=sum(message_count)&timeRange=01/16/2019%2000:00~2/01/2019%2000:00&timeUnit=month&filter=(apiproxy%20like%20'abc%')&limit=14400
Even without the header you should be getting 401.
i agree with this of getting 401 by sending request via browsers. But i have script which uses httpconnectionurl library where i'm providing credentials then i don't get any authorization error.
But i'm wondering with response(500 internal server...) i got using % operator when running in script using IntelliJ tool
I think that the last percent char '%' should be url-encoded in your like clause. If not, this could be the reason why you get a 500 error.
Did you try something like this :
https://{host}/v1/organizations/{abc}/environments/{xyz}/stats/apiproxy?select=sum(message_count)&timeRange=01/16/2019%2000:00~2/01/2019%2000:00&timeUnit=month&filter=(apiproxy%20like%20'abc%25')&limit=14400
(but it doesn't explain why it works with Postman)
Thanks @Nicolas TISSERAND
I ran the script again and it gave me the result
earlier case and now also:
but
Thank you very much....!!
Hi @manikanta ponneri Glad to hear that.If you don't mind, please vote for my answer in order to mark this topic as resolved. Or @Dino-at-Google could do it ?
Done.......
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |