Partly able to use postman for querying genesys cloud API

Hi Dev Forum ,

I am able to query genesys cloud's GET Routing Skill API via postman . But conversation details api (which uses some query params) is giving me below error . I am first using API explorer to get results and using that query in POSTMAN body .I think i am making some mistake in passing the body in POSTMAN .

"403 ERROR
The request could not be satisfied.
Bad request. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation. "

curl -X GET
https://api.aps1.pure.cloud/api/v2/analytics/conversations/details
-H 'Accept: application/json'
-H 'Accept-Encoding: gzip, deflate'
-H 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxx'
-H 'Cache-Control: no-cache'
-H 'Connection: keep-alive'
-H 'Content-Length: 385'
-H 'Content-Type: application/x-www-form-urlencoded'
-H 'Host: api.aps1.pure.cloud'
-H 'Postman-Token: xxxxxxxxxxxxxx'
-H 'User-Agent: PostmanRuntime/7.15.2'
-H 'authorization: bearer xxxxxxxxxxxxxxx'
-H 'cache-control: no-cache'

Attaching snapshots :-


Regards
Garima.

@garimabalodi
Please regenerate your client secret IMMEDIATELY and check your org for unauthorized access. I edited your credentials out of your post, but they were exposed to the open internet for some time. Your client secret must be handled like a password.

Thanks Jerome for pointing that out
!! i missed to hide them . I am testing this on my lab and have changed it .

Can you please help on my original query.

Regards
Garima.

What I would recommend is to start by using proper header values in your postman request.
I see that you are sending this request with Content-Type: application/x-www-form-urlencoded
Such API endpoints are application/json.
I also see you are sending a Content-Length of 385 when your request appears to be a GET - which usually don't have bodies.
I also see that your request in Dev Tools is GET /api/v2/routing/skills/{skillId} when your Postman request is GET
https://api.aps1.pure.cloud/api/v2/analytics/conversations/details, ...

Regards,

@garimabalodi you also have an extra slash in the path in the request. This is likely malforming the request and causing it to not be routed to the API correctly because the path is incorrect. That's why you're getting an HTML error page instead of an error payload from the API; your request isn't reaching the API service.

Hi tim ,

i removed the slash and still get the same error .

regards
garima.

Hello,

You are not using the right endpoint or you are using it improperly.

Your screenshot shows GET /api/v2/analytics/conversations/details with a body where you have set interval/filters.
That's not correct.
This GET API endpoint take an input parameter - id (the conversation id) as path/query parameter - i.e. GET /api/v2/analytics/conversations/details?id=YOUR_CONVERSATION_ID

If you want to perform an analytics query for conversation details (I guess based on the body you are trying to use), it is with POST /api/v2/analytics/conversations/details/query

Regards,

@garimabalodi I'd strongly recommend using the API Explorer tool Jerome linked. It will do the heavy lifting for you and guide you to create a successful request. Once you have a query working to your liking, you can then stare and compare your postman configuration against the working API Explorer request to configure postman correctly.

I figured out how to get an HTML error like that. I'm getting a 400 instead of a 403, but it's the same format. The cause is an inappropriate content type. You're not using text, you're trying to send json, so change that dropdown in postman accordingly. Also decide which endpoint you're using; your screenshot shows the GET endpoint, but you're sending a JSON body that goes with the POST /query endpoint.

image

Hi Jerome ,

Thanks for pointitg that out ..
I intended to use query api but missed /query . After adding that and changing it to POST it is working fine.

Regards
Garima.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.