Srikanth_Sunkara | 2017-09-20 00:04:20 UTC | #1
Hi,
When we are trying to request for a new Token from post man accessing the Analytics API, we are receiving below error
https://api.{{environment}}/api/v2/analytics/reporting/schedules
Error Message:<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/74376b4fb60aeac294a4e9ae77fb4bfcae38d332.png" width="690" height="388">
Please note that we just followed the steps from the website
https://developer.mypurecloud.com/api/rest/postman/
Can you please advise on the error message and how to fix it?
Regards Srikanth Sunkara
tim.smith | 2017-09-20 14:08:18 UTC | #2
Can you provide screenshots of your postman configuration please?
Srikanth_Sunkara | 2017-09-21 14:13:31 UTC | #3
<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/ba26932a064b80f1fab50516486a706dcee1f1d3.PNG" width="690" height="392">
tim.smith | 2017-09-21 14:18:25 UTC | #4
Make sure your oauth client is configured as a auth code grant and make sure that the environment variable is set to mypurecloud.com.au (I'm assuming that's your region based on your profile config). Also, keep in mind that OAuth clients do not span regions, so you have to have created it in the same region you're using to log in. Beyond that, inspect the postman page and see if you can get more information from the network requests.
Srikanth_Sunkara | 2017-09-25 02:22:54 UTC | #5
Thanks! Tim. I have set the environment variable now and also changed grant type to client credentials as we have the same settings under Oauth. I could able to access some of the resources API calls.
I have a new issue where i am trying to call using postman and i receive {"status":403,"code":"not.authorized","message":"You are not authorized to perform the requested action."}
Can you please advise?
Request URL:https://api.mypurecloud.com.au/api/v2/analytics/conversations/df317a35-ca43-4cfd-a59e-ac38a8d6c104/details
Request Headers
:authority:api.mypurecloud.com.au :method:GET :path:/api/v2/analytics/conversations/df317a35-ca43-4cfd-a59e-ac38a8d6c104/details :scheme:https accept:/ accept-encoding:gzip, deflate, br accept-language:en-US,en;q=0.8 authorization:Bearer VKSAsW-wZX8ewykAl49jdq8mNR8Hklxb4G83oEOnjujEDJXKi6IopjfRU4Aktt8Yax9zVPmUq6fI9D4oAsGg cache-control:no-cache content-type:application/json postman-token:367847bf-5597-0016-8e6f-ea10cdc026e3 user-agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36
Response Headers
cache-control:no-cache, no-store, must-revalidate content-length:106 content-type:application/json date:Mon, 25 Sep 2017 02:15:49 GMT expires:0 inin-correlation-id:cb9254e3-42ca-43b3-a87d-62d0f694ea1e inin-ratelimit-allowed:300 inin-ratelimit-count:1 inin-ratelimit-reset:60 pragma:no-cache status:403
kripette | 2017-09-25 10:42:13 UTC | #6
Hi,
That's a permission related issue. I would check the role you assigned to the OAuth configured in PureCloud. Make sure that the role you assigned has these permissions:
<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/5ff30ff9ea6636623a6212c4d5966d8da07289f8.png" width="690" height="282">
tim.smith | 2017-09-25 16:30:42 UTC | #7
Additionally, the required permissions are documented on this resource:
GET /api/v2/analytics/conversations/{conversationId}/details
<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/0d2d0525381c612737314536ecbf67a2856e3d11.png" width="493" height="244">
Srikanth_Sunkara | 2017-09-26 07:55:04 UTC | #8
Thanks! Kripette. I will check with my admin team.
Srikanth_Sunkara | 2017-09-26 07:56:17 UTC | #9
<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/40b694ccd4bfaa7c42901e247e7bcb2040e31fb2.PNG" width="690" height="393">
Can you please check the role i am assigned is sufficient to access the APIs?
kripette | 2017-09-26 08:21:04 UTC | #10
Looks like you have the required permission based on what Tim said. If you are using other endpoints on the API you need to check that you meet those requirements as well, but you should be able to make requests to /api/v2/analytics/conversations/{conversationId}/details
tim.smith | 2017-09-26 13:38:12 UTC | #11
Keep in mind that the request you're making (the one posted above) is using client credentials for authorization. The role assigned to the OAuth client is how permissions will be determined; your user's configuration is irrelevant because your user isn't making that request.
Srikanth_Sunkara | 2017-09-29 01:36:29 UTC | #12
yeah Tim. I understand now. so how can I make a request using client credentials to resolve the error. currently I am getting unauthorized permission. Do I need to switch to authorization code? My only concern is if I change the settings in pure cloud to authorization grant type, it impacts the current apex code as it is using client credentials to make an API Call?
tim.smith | 2017-10-02 16:08:00 UTC | #13
If you're using client credentials, assign the required permissions to the role that's assigned to that oauth client.
system | 2017-11-02 16:08:19 UTC | #14
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 1825