Legacy Dev Forum Posts

 View Only

Sign Up

API Calls/Query for conversation aggregates

  • 1.  API Calls/Query for conversation aggregates

    Posted 06-05-2025 19:07

    asikarwar | 2021-06-25 12:18:00 UTC | #1

    Hi,

    This forum is really helpful.

    My company uses Genesys solutions. I can login to https://login.mypurecloud.com/

    I am a developer and one of my internal teams needs my help in extracting all possible data from purecloud. I learned using the Analytics Post API it is possible thanks to Ronan

    I began with postman to understand how this works Get Real-Time and Historical Data with the Analytics API

    Challenges: With Basic Auth i get error "error": "invalid_request"

    Do I need some kind of auth token from login.mypurecloud.com/oauth/token to send a Post request to

    https://api.mypurecloud.com/api/v2/analytics/conversations/aggregates/query

    I want to write a python script with fixed 1 minute interval which will extract data from cloud and store it under in our local DB

    Will OAuth Client Credentials Login Flow Using Python be helpful to extract data from purecloud?

    Thanks Ashish


    asikarwar | 2021-06-25 10:35:17 UTC | #2

    In OAuth Client Credentials Login Flow Using Python Do I need to supply credentials I use for login.mypurecloud.com?

    Example:

    CLIENTID = os.environ['testuser'] CLIENT_SECRET = os.environ['mypassword'] ENVIRONMENT = os.environ['mypurecloud.com'] # eg. mypurecloud.com


    asikarwar | 2021-06-25 11:18:53 UTC | #3

    Can I get the client ID etc. information from developer-tools ?

    I do not see Integrations under Admin I was following the link create-an-oauth-client


    asikarwar | 2021-06-25 11:13:35 UTC | #4

    Tried this query I am getting the following message

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

    What and whom do i need to request the required access? I assume this will prevent me from using python script also?


    asikarwar | 2021-06-25 11:19:42 UTC | #5

    Overall I need help in setting an API call using python script (but to learn i was trying to use postman) can somebody please guide?


    anon11147534 | 2021-06-25 16:20:36 UTC | #6

    I do not see Integrations under Admin I was following the link create-an-oauth-client

    You'd need admin privileges to create an OAuth client.

    What and whom do i need to request the required access? I assume this will prevent me from using python script also?

    The OAuth client needs to have the analytics:queueObservation:view permission to call that API. You can ask your organization admin to add the required permissions to the OAuth client.

    Overall I need help in setting an API call using python script (but to learn i was trying to use postman) can somebody please guide?

    Firstly you'll probably want to authenticate using client credentials

    My answer to this forum post shows how to use a similar analytics API. The best thing to do is use the analytics query builder to build the queries you'll be sending and then translate it to python.


    asikarwar | 2021-06-25 15:01:52 UTC | #7

    Thank you Ronan! May I know where exactly I will get GENESYSCLOUDCLIENTID, GENESYSCLOUDCLIENTSECRET from?

    apiclient = PureCloudPlatformClientV2.apiclient.ApiClient().getclientcredentialstoken(os.environ['GENESYSCLOUDCLIENTID'], os.environ['GENESYSCLOUDCLIENTSECRET']) authApi = PureCloudPlatformClientV2.AuthorizationApi(apiclient) print(authApi.getauthorizationpermissions())

    Thanks Ashish


    John_Carnell | 2021-06-25 16:15:24 UTC | #8

    Hi Ashish,

    These are environment variables you would set in your environment containing your Oauth Client Credential Id and OAuth Client Credential Secret. These values are defined in the Genesys Cloud UI. Instructions for setting up the OAuth Client can be found here.

    Thanks, John Carnell Manager, Developer Engagement


    asikarwar | 2021-06-25 16:19:09 UTC | #9

    Thank you @John_Carnell Either I have to have admin privileges or an organization Admin can add this for me, right?

    Thanks Ashish


    John_Carnell | 2021-06-25 16:20:03 UTC | #10

    Hi Ashish,

    That is correct.

    • John

    asikarwar | 2021-06-25 16:21:07 UTC | #11

    Thank you John!


    system | 2021-07-25 16:21:11 UTC | #12

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


    This post was migrated from the old Developer Forum.

    ref: 11313