Like Operator getting failed in BROWSERS while in POSTMAN iam able to retrieve expected data

@Dino-at-Google

@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 Solved
1 6 840
1 ACCEPTED SOLUTION

Hi @manikanta ponneri

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)

View solution in original post

6 REPLIES 6

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

Hi @manikanta ponneri

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:

  • i got this error Server returned HTTP response code: 500 for URLwhen i used filter=(apiproxy%20like%20'abc%')&limit=14400

but

  • when i used this filter=(apiproxy%20like%20'abc%25')&limit=14400 i got the expected result.

Thank you very much....!!

9263-capture.jpg

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.......