Hello everyone,
We are trying to export the current presence details of each of our users via the API. I've included a snippet of our python code below. Executing this code works, but due to what I assume is API limitations the results fed back to us are throttled. It will do a few loops and then pause, it can take several minutes to get through all of the users.
Is there another method or API call we can use to bulk request these details, or some way to get around the throttled result feed?
We need each user's current presence as a starting point for a monitoring dashboard we are creating. We utilize the notifications system via webhooks to monitor for any presence changes throughout the day, but without knowing their initial presence when the webhook connects, our starting dataset will be inaccurate. We also need to be able to pull their current presence in case the notifications channel drops connection and we miss changes that occurred while disconnected.
Any suggestions are welcomed!
Python code snippet:
from PureCloudPlatformClientV2.rest import ApiException
import PureCloudPlatformClientV2
client_id = *****
client_secret = *****
# Authenticate
region = PureCloudPlatformClientV2.PureCloudRegionHosts.ca_central_1
PureCloudPlatformClientV2.configuration.host = region.get_api_host()
api_client = PureCloudPlatformClientV2.api_client.ApiClient().get_client_credentials_token(client_id, client_secret)
# usersApi = PureCloudPlatformClientV2.UsersApi(api_client)
# create an instance of the API class
api_instance = PureCloudPlatformClientV2.PresenceApi(api_client)
divisions = get_division()
agent_ids = get_agent_ids(divisions)
try:
for agent_id in agent_ids:
# Get a user's Genesys Cloud presence.
api_response = api_instance.get_user_presences_purecloud(agent_id)
print(api_response)
except ApiException as e:
print("Exception when calling GetUserPresencesPurecloudRequest->get_user_presences_purecloud: %s\n" % e)
#SystemAdministration------------------------------
David Perry
Pizza Pizza Ltd.
------------------------------