You were very professional and very kind.
Thanks again.
Regards
Original Message:
Sent: 10-09-2025 04:54
From: Jerome Saint-Marc
Subject: How can I add a user to a queue using the Genesys Cloud Python APIs?
Hello,
You can use the GET /api/v2/routing/queues endpoint, using the name parameter to specify/search for your queue based on its name.
I haven't tested the following code this time but guess it should work:
api_instance = PureCloudPlatformClientV2.RoutingApi(api_client)
page_number = 1 # int | Page number (optional) (default to 1)
page_size = 25 # int | Page size (optional) (default to 25)
sort_order = 'asc' # str | Note: results are sorted by name. (optional) (default to 'asc')
name = 'TEST_QUEUE_10' # str | Include only queues with the given name (leading and trailing asterisks allowed) (optional)
api_response = api_instance.get_routing_queues(page_number=page_number, page_size=page_size, sort_order=sort_order, name=name)
Regards,
------------------------------
Jerome Saint-Marc
Senior Development Support Engineer
Original Message:
Sent: 10-09-2025 03:59
From: Giampiero Casu
Subject: How can I add a user to a queue using the Genesys Cloud Python APIs?
Hi Jerome, thank you so much, your code works perfectly!
Thanks to your support, I solved the problem. Thanks again :)
Can I ask you something else, please?
How can I find the ID of a queue using the API and Python if I know its name?
For example, the queue name is "TEST_QUEUE_10." What API call (Python) can I use to find its ID?
Using the Genesys Cloud API and Python.
Thank you so much if you can help me.
Bye, and thanks again for your support.
------------------------------
Giampy
Original Message:
Sent: 10-09-2025 03:19
From: Jerome Saint-Marc
Subject: How can I add a user to a queue using the Genesys Cloud Python APIs?
Hello,
Your code is correct to join or unjoin a user from a queue (a queue that the user is already a member of).
Code would look like this (for a single user):
api_instance = PureCloudPlatformClientV2.RoutingApi(api_client);
queue_id = 'a6e*****-****-4**0-a**5-5**********0'
first_user = PureCloudPlatformClientV2.WritableEntity()
first_user.id = 14######-9##1-4###-8926-2##########2'
body = [first_user] # list[WritableEntity] | Queue Members
delete = False # bool | True to delete queue members (optional) (default to False)
api_instance.post_routing_queue_members(queue_id, body, delete=delete)
Regards,
------------------------------
Jerome Saint-Marc
Senior Development Support Engineer
Original Message:
Sent: 10-08-2025 15:16
From: Giampiero Casu
Subject: How can I add a user to a queue using the Genesys Cloud Python APIs?
Hi everyone.
I'm trying to add a user to a queue using the Genesys Cloud APIs and Python.
I read in the documentation that the patch_user_queue method should be used, and I'm using the code found in the API documentation (https://developer.genesys.cloud/devapps/api-explorer#patch-api-v2-users--userId--queues--queueId-)
The code I'm using is this:
api_client = PureCloudPlatformClientV2.api_client.ApiClient().get_client_credentials_token(GENESYS_CLOUD_CLIENT_ID, GENESYS_CLOUD_CLIENT_SECRET)
api_instance = PureCloudPlatformClientV2.UsersApi(api_client)
queue_id = 'a6e*****-****-4**0-a**5-5************0'
user_id='14######-9##1-4###-8926-2##########2'
body = PureCloudPlatformClientV2.UserQueue()
body.id='a6e*****-****-4**0-a**5-5**********0'
body.joined=True
api_response = api_instance.patch_user_queue(queue_id, user_id, body)
But I always get the following error:
HTTP response body: {"message":"The server encountered an unexpected condition which prevented it from fulfilling the request.",
"code":"internal.server.error","status":500,"contextId":"9*******f-####-####-####-4##########2","details":[],"errors":[]}
I think the problem is the body object I'm passing to the function patch_user_queue, but I don't understand how it should be valued.
Can anyone help me?
Thank you so much.
#PlatformAPI
------------------------------
Giampy
------------------------------