Chris_Phillips | 2020-03-24 22:16:36 UTC | #1
Hello
I am trying to change a users presence using the API. I have tried using the JS sdk, but since that wasn't working I have reverted to trying with the REST api directly.
eg call
PATCH https://api.mypurecloud.com/api/v2/users/{userid}/presences/PURECLOUD
body: {"id":"123abc"}. the ID is looked up by calling the systemPresences endpoint
It is always returning a 200. But the status never changes no matter what ones I try.
Thanks
Chris
tim.smith | 2020-03-24 22:23:32 UTC | #2
Chris_Phillips, post:1, topic:7396
But the status never changes no matter what ones I try.
How are you verifying this? Genesys Cloud app? API request? Also, please provide the correlation ID from the response.
Chris_Phillips | 2020-03-24 22:25:20 UTC | #3
I verified both with developer tools (in chrome) and with insomnia (like postman)
eg
PATCH /api/v2/users/<REDACTED>/presences/PURECLOUD HTTP/1.1
Host: api.mypurecloud.com
User-Agent: insomnia/7.1.1
Content-Type: application/json
Authorization: Bearer <REDACTED>
Accept: /
Content-Length: 48
| { | "id":"<REDACTED>" | }
HTTP/1.1 200 OK < Content-Length: 0 < Connection: keep-alive < Date: Tue, 24 Mar 2020 22:09:55 GMT < ININ-Correlation-Id: 09208bec-ab27-49d1-924e-9d49d7cb1260 < inin-ratelimit-count: 3 < inin-ratelimit-allowed: 180 < inin-ratelimit-reset: 19 < Strict-Transport-Security: max-age=600; includeSubDomains < Cache-Control: no-cache, no-store, must-revalidate < Pragma: no-cache < Expires: 0 < X-Cache: Miss from cloudfront < Via: 1.1 d042f60a962591f741406f28a8170c5a.cloudfront.net (CloudFront) < X-Amz-Cf-Pop: SEA19-C1 < X-Amz-Cf-Id: a8gH8bYR-Xl1ZNtQGIS5BWf8L-f3MTVhh9x327rCK-stlLuf1i2XKg==
tim.smith | 2020-03-24 22:41:01 UTC | #4
I mean what steps are you taking to verify the presence change after the API request is completed? How do you know that the user's presence wasn't changed?
Chris_Phillips | 2020-03-24 22:55:35 UTC | #5
calling GET https://api.mypurecloud.com/api/v2/users/REDACTED/presences/PURECLOUD
eg in the above call I did a PATCH with payload (note that is the ID for the AWAY presence)
{ "id":"5e5c5c66-ea97-4e7f-ac41-6424784829f2" }
it returns a 200.
Then I do a GET call to same URL
{ "source": "PURECLOUD", "presenceDefinition": { "id": "6a3af858-942f-489d-9700-5f9bcdcdae9b", "systemPresence": "Available", "selfUri": "/api/v2/presencedefinitions/6a3af858-942f-489d-9700-5f9bcdcdae9b" }, "message": "", "modifiedDate": "2020-03-24T22:06:35.043Z", "selfUri": "/api/v2/users/<REDACTED>/presences/PURECLOUD" }
Thanks
chris
Jerome.Saint-Marc | 2020-03-25 06:52:24 UTC | #6
Hello,
The body/payload you are using in your PATCH is incorrect. It should be:
{ "presenceDefinition": { "id": "5e5c5c66-ea97-4e7f-ac41-6424784829f2" } }
Chris_Phillips | 2020-03-25 16:05:23 UTC | #7
Ahh, thank you so much, that fixed it Jerome.
Take care
Chris
system | 2020-04-25 16:05:26 UTC | #8
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: 7396