Legacy Dev Forum Posts

 View Only

Sign Up

How to read response results from Coversation Aggregates Query Function with c#

  • 1.  How to read response results from Coversation Aggregates Query Function with c#

    Posted 06-05-2025 18:06

    SeowLengNg | 2020-03-19 10:46:23 UTC | #1

    Hi,

    I would like to know how can i read the returned result from API function "PostAnalyticsConversationsAggregatesQueryAsyncWithHttpInfo (Body)" and convert it to json format?

    Example:

    var analytics = new AnalyticsApi(); var Res = analytics.PostAnalyticsConversationsAggregatesQueryAsyncWithHttpInfo(AggBody); Console.WriteLine($"Result, {Res.ToJson()}");

    It's not work. Please advise.

    Thanks!


    tim.smith | 2020-03-19 22:09:22 UTC | #2

    I assume you're getting an error because that method doesn't exist? Try Res.Data.ToJson().


    SeowLengNg | 2020-03-23 10:23:18 UTC | #3

    Hi Smith,

    I hit the following error when calling from:

    var analytics = new AnalyticsApi(); var Res = analytics.PostAnalyticsConversationsAggregatesQuery(AggBody); Console.WriteLine($"Result, {Res.ToJson()}");

    Error:

    Error calling PostAnalyticsConversationsAggregatesQuery: {"message":"Unable to perform the requested action. You are missing the following permission 'analytics:conversationAggregate:view' in the provided division(s).","code":"missing.division.permission","status":403}

    In fact, I'm using Client Credentials Grant method (non-human) for my app authentication.

    I have no idea, why i getting this error.

    My objective is very simple, i just want to pull Queue Metric Daily report data from PureCloud and store to my local database.

    Can you please advise what can i do next?

    Thanks!


    Jerome.Saint-Marc | 2020-03-23 14:40:02 UTC | #4

    Hello,

    The problem is not to read the response result.

    As indicated by the error message, the OAuth client (Client Credentials) you created just does not have the necessary privileges/permissions to execute this request.

    When you create an OAuth client (Client Credentials), you have to assign a set of Roles to it (Roles Tab in the OAuth Client) - which will assign a set of privileges/permissions to this OAuth client. The same way you need to assign a set of roles to a user to allow him to access certain capabilities.

    In your case, you need to assign an existing Role that contains the analytics:conversationAggregate:view permission (with assigned Division corresponding to the objects/queues you want to query). Or you can create a custom Role which only contains the permissions that your app requires. See here for info on creating an OAuth Client and assigning the roles: https://help.mypurecloud.com/articles/create-an-oauth-client/

    If your application makes use of other API requests (other than the analytics conversations aggregates), you'll need to assign/enable these permissions as well.

    Regards,

    Jerome


    SeowLengNg | 2020-03-24 02:01:45 UTC | #5

    Hi Jerome,

    Thanks so much! I'm able to get my results. :)

    Best Regards, Seow Leng


    system | 2020-04-24 02:01:45 UTC | #6

    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: 7380