Genesys api Grant type

Hi,

I need to retrieve data from API "https://api.mypurecloud.com/api/v2/conversations/calls/history" which requires an authorization token.

When I try creating an authorization token using grant_type as "code_authorization" and use that token in my API, I am able to get data for few API's only, not all,
where as when I try the same process for grant_type as "client_credentials", I get empty data JSON array with http status code "200 OK".

eg: when I try calling https://api.mypurecloud.com/api/v2/conversations/calls/history in postman with auth token having grant_type = "client_credentials" , I receive status code "200 OK" with empty data JSON array.

-- Rasika

Does accessing this API using grant type as Client credentials requires any additional permissions? As same are accessible using Implicit, Saml2Bearer and Code Authorization grants.

Regards,
Ameya

Hi Team,

Can we have any update on this ? We have hit a road block here and need some directions if we are missing anything ?

Regards,
Ameya

Hi Ameya,

I am going to verify this with the dev team, but I suspect you need a user context (which client credential grants do not have.

Thanks,
John

Hi John,

Thanks for the response, Are you saying the below API specifically needs user context and not other ?
https://api.mypurecloud.com/api/v2/conversations/calls/history

Also we noticed the API is giving blank response using grant type as Code Authorization for specific user ID's only. For eg: if i use my login credentials i am getting correct output for the API, however if i use my teammates ID its returns me blank response.
NOTE : All ID's are having identical roles and permission.

We just want to understand are we missing anything here ?

Regards,
Ameya

Hi Team,

Can we have any update on this ? Is this an abnormal behavior what we are experiencing ?

Regards,
Ameya

Hello,

As far as I know, this API request (GET/api/v2/conversations/calls/history) is only to get the calls for the authenticated user.
If you want different set of calls in the system (received by other users), or make a query with a Client Credentials grant (as you are not using a user account to authenticate in this case), you would need to submit a query for conversation details (POST /api/v2/analytics/conversations/details/query).

Regards,

Hi Jerome,

Thank you for your reply.

I tried using the above given Query for conversation details (POST /api/v2/analytics/conversations/details/query) in my postman, but i got HTTP 404 not found error.

Correct me if I am wrong, I have put below JSON(empty and without values) in the body of this above POST API. However, I am unaware what could be those values be or where can I find them.

Help of any kind is highly appreciated.! Query API|690x448

Request body of POST API:

{
"conversationFilters": [
{
"type": "",
"clauses": [
{
"type": "",
"predicates": [
{
"type": "",
"dimension": "",
"metric": "",
"operator": "",
"value": "",
"range": ""
}
]
}
],
"predicates": [
""
]
}
],
"segmentFilters": [
{
"type": "",
"clauses": [
{
"type": "",
"predicates": [
{
"type": "",
"dimension": "",
"propertyType": "",
"property": "",
"metric": "",
"operator": "",
"value": "",
"range": ""
}
]
}
],
.........

Thanks,
Rasika.

Hello,

This body (JSON with empty values) is not a valid one for the Analytics Query for Conversation Details.

You can find background information on this Analytics Query and its request body on the Developer Center - here and here.

I would also suggest to experiment this API request using the Analytics Query Builder in the Developer Tools.
The tool helps to build the request body of the different Analytics queries.

Regards,

Hi Jerome,

That worked.!! Thanks a lot for your Help.!! Appreciated .!!

Thanks,
Rasika

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