EnriqueGarciaPablo | 2020-11-05 22:23:07 UTC | #1
Hi there,
I've seen that other members posted some topics about this subject before ( wchavez, and it seems that there is not a solution yet.
In our case we're using the GenesysCloud API for testing purposes and we need to change the routing status for some agents programatically according to the request https://developer.mypurecloud.com/api/rest/v2/users/#put-api-v2-users--userId--routingstatus.
For instance, using python SDK (I've tried another SDKs as well, even curl directly, but finally the exception is always the same):
import PureCloudPlatformClientV2 as V2client apiclient = V2client.ApiClient().getclientcredentialstoken( <PURECLOUDCLIENTID>, <PURECLOUDCLIENTSECRET> ) rs = V2client.RoutingStatus() rs.userid = <userID> rs.status = "IDLE" V2client.UsersApi(apiclient=apiclient).putuserroutingstatus( userid=<userId>, body=rs )
Note that the "\<userId\>" is the id of one agent and "\<PURECLOUDCLIENTID\>" and "\<PURECLOUDCLIENTSECRET\>" are the client credentials.
Above python script always raises following exception (same effect with any SDK or curl):
HTTP response body: {"message":"Agent \<userId\> does not exist.","code":"resource.not.found","status":404,"messageWithParams":"{entity} {id} does not exist.","messageParams":{"id":"\<userId\>","entity":"Agent"},"contextId":"...","details":[],"errors":[]}
However, the request to get routing status of that userId works fine (It means resource "/api/v2/users/\<userId\>" exists, obviously)
V2_client.UsersApi(api_client=api_client).get_user_routingstatus(user_id=<userId>).status
Could anyone please help me ? what is wrong with this API call ?
Thanks in advance.
tim.smith | 2020-11-05 22:18:52 UTC | #2
Can you share the correlation ID please?
EnriqueGarciaPablo | 2020-11-05 22:26:45 UTC | #3
CorrelationId or contextId ?
For the request above --> 'ININ-Correlation-Id': '7f84b471-db3f-4923-a067-4a5fd287219c'
tim.smith | 2020-11-05 22:47:16 UTC | #4
There's nothing in the server-side logging to indicate an issue. My guess would be that this might be an issue with divisions, but that's 100% a guess; there's no traces to actually suggest that. Please open a case with Genesys Cloud Care to investigate further.
EnriqueGarciaPablo | 2020-11-06 07:28:33 UTC | #5
Thanks a lot for your time, this issue make me use Selenium Webdriver to move the toggle button in order to change the routing status of agents, a very hard work for a simple API call, : -( ...
Jerome.Saint-Marc | 2020-11-06 12:07:02 UTC | #6
Hello,
I have done few tests using the Users and Presence API and I think I know what the problem is.
The PUT /api/v2/users/{userId}/routingstatus, as explained here, is only to allow to transition from a NOT_RESPONDING state to an IDLE state. If you perform this query while the user is not On Queue, it will send back a 404 error (like the specified user was not found as being active on a queue - I mean on a status different than "On Queue"). If you perform this query while the user is On Queue, but is not in a NOT_RESPONDING state, it will send back a 400 error (specifying that the transition of state you requested is not allowed).
If you want to put a user on queue, or off queue (available, Busy, Away, ...), you must use the PATCH /api/v2/users/{userId}/presences/{sourceId} You would change the user presence to the "On Queue" status with: -> userId = id of your user -> sourceId = PURECLOUD -> body: something like {"presenceDefinition":{"id":"id of the presence definition for the new presence status"}} In case of On Queue, it is a system presence and you can find its id with a GET /api/v2/systempresences
Regards,
EnriqueGarciaPablo | 2020-11-06 12:45:09 UTC | #7
Thank you very much for all info, I'm going to check it out right away !!
EnriqueGarciaPablo | 2020-11-06 13:19:10 UTC | #8
@Jerome.Saint-Marc you're right, everything works as you said.
Thank you so much :sunny:
system | 2020-12-07 13:31:59 UTC | #9
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: 9255