Get Number of On-Queue Agents using PureCloud SDK

Hello,

I'm trying to create a Python application to get number of On-Queue Agents using PureCloud SDK.

I've followed the steps described in the link below :
https://developer.mypurecloud.com/api/tutorials/number-of-agent-in-queue/?language=python&step=2

But, I am facing 2 errors:

  • In step 2, to obtain an Access Token, I need to make a POST call to https://login.mypureclud.De/oauth/token, and I got an error : Method Not Allowed

  • When Running my Python program, I got an error in the line holding the Client ID & Secret ID

Appreciate you help !

CHARAF

1 Like

Can you share your code that's causing this? The SDK is coded to make the proper request. If you're using the SDK's auth helper, it shouldn't be possible to make a request using an incorrect HTTP method.

os.environ['PURECLOUD_CLIENT_ID'] gets the value of the environment variable PURECLOUD_CLIENT_ID. It looks like you replaced the name of the environment variables with your client id and secret. If you're going to hardcode the values, just use the hardcoded values and do not attempt to retrieve them from environment variables.

I just clicked in the link https://login.mypurecloud.de/oauth/token . Where I can find code that cause this ?

You're right, I replaced the name of the environment variables with my client ID & secret ID generated in PureCloud.
How my application will authenticate in my case without replacing the variables ?

Appreciate your help

CHARAF

I'm not sure what you're talking about. You're writing a Python script, correct? In that context, I don't understand where you're clicking a link for anything.

The tutorial retrieves the client credentials from environment variables. You're welcome to write your app however you like to handle your client credentials. Just remember that the client secret should be handled like a password.

I added the code used here to authenticate my request ( https://developer.mypurecloud.com.au/api/tutorials/oauth-client-credentials/?language=python&step=1)

So, after running my Python script, I'm not getting the errors anymore but nothing seems to happen

Here is the response :
image

The API call should get the users of the queue with the desired routing status. ("IDLE", "INTERACTING") though !

That tutorial is for when you're explicitly not using the SDK. Please follow the SDK's documentation and the SDK tutorials (e.g. the one you linked in your first post) for how to authenticate with the SDK.

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