Legacy Dev Forum Posts

 View Only

Sign Up

"not.a.user","message":"This request requires a user context. Client credentials cannot be used for requests to this resource

  • 1.  "not.a.user","message":"This request requires a user context. Client credentials cannot be used for requests to this resource

    Posted 06-05-2025 18:04

    sajidali | 2016-11-03 15:06:00 UTC | #1

    Hi, i have seen answers to this error in the forum but i am not sure if i had the similar scenario. I have receieved the clientID and client secet. Then i used ININ.PureCloudApi to get the accessToken in C# code. Now i need to get all the calls from ConversationApi.

    var accessToken = accessTokenInfo.AccessToken; Configuration.Default.AccessToken = accessToken; var apiInstance = new ConversationsApi(); var test=apiInstance.GetCalls();//error at this line.. {"status":400,"code":"not.a.user","message":"This request requires a user context. Client credentials cannot be used for requests to this resource."}

    As i already have the accessToken, why should i need to implement implicit or OAuth to get this information?


    tim.smith | 2016-11-03 15:26:34 UTC | #2

    GET /api/v2/conversations/calls gets the active calls for the current user. Because you're using client credentials, there isn't a user, and therefore can't be any calls, hence the error. The Authorization pages have additional information about the different grant types.

    You'll want to use the analytics queries: POST /api/v2/analytics/conversations/details/query and in the SDK AnalyticsApi.postConversationsDetailsQuery(...)


    sajidali | 2016-11-03 16:06:14 UTC | #3

    Thank you, that helped alot.


    sajidali | 2016-11-04 10:43:14 UTC | #4

    Hi Tim, Thanks for the help. I am going to do the PureCloud integration with our WFM software. I am interested in following information.

    1. All-Queue statistics

    e.g; Interval, Queue name, offered calls, abandoned calls etc

    1. All agent statistics

    e.g; Agent name/id, available duration, pause duration ect

    1. All agent queue statistics

    e.g; Information like which agents working with which queues..

    So basically i am interested if this information can be fetched from Analytics api or should i have to use Conversation api?


    tim.smith | 2016-11-04 15:43:38 UTC | #5

    All of the conversation APIs are scoped to a user, which you can't use with client credentials. They won't give you statistics either (except for the couple analytics resources that are linked in that category). You'll want to use the Analytics APIs. Take a look through the articles on the right sidebar for information on how to use them. Also check out the Analytics Query Builder. It's a really helpful tool to use to construct analytics queries. It doesn't generate code for the SDKs, but it will help you build a valid query you can use as a reference when building the query via the SDK.


    sajidali | 2016-11-06 19:35:53 UTC | #6

    Thank you Tim. I cant open the link to query builder link using purecloud forum user. May i know which rights/roles i need for my app.purecloud user to access this tool?


    tim.smith | 2016-11-07 16:58:40 UTC | #7

    You can log in with any PureCloud user in a mypurecloud.com org (or .ie, .jp, or .com.au). We do this so when you log in, all of the API calls will be made for your user in your org.


    system | 2017-08-28 19:28:22 UTC | #8


    This post was migrated from the old Developer Forum.

    ref: 570