Jack_Nichols | 2017-05-08 14:58:34 UTC | #1
A recent question from a partner was about the ability to add/change users photos via the API. They want to be able to sync photos between a few different systems. Within Users we did not see anything to accomplish this, but figured we would ask this group.
RogierBosch | 2017-05-09 06:35:46 UTC | #2
Patch PATCH /api/v2/users/{userId}
UserImage resolution (string, optional): Height and/or width of image. ex: 640x480 or x128 imageUri (string, optional):
Hugo_Pastore | 2017-05-16 17:40:12 UTC | #3
Hi, I tried using this route but I get a 400 with no explanation. (Note: I tried running the following both with the user itself and with a master admin one so I don't think it's about permissions.)
My request looks like this <code>requests.patch(PURECLOUDURL + '/api/v2/users/' + str(purecloudid), headers={'Content-Type': 'application/json', 'Authorization': response.json()['tokentype'] + ' ' + response.json()['accesstoken']}, data=json.dumps({'UserImage': { 'imageUri': "https://api.doppelme.com/" + doppelmekey + "/crop.png", "resolution": "100x100"} }))</code>
I also tried with the payload being images instead of UserImage <code> r = requests.patch(PURECLOUDAPIURL + '/api/v2/users/' + str(purecloudid), headers={'Content-Type': 'application/json', 'Authorization': response.json()['tokentype'] + ' ' + response.json()['accesstoken']}, data=json.dumps({'images': [{ 'imageUri': "https://api.doppelme.com/" + doppelme_key + "/crop.png", "resolution": "100x100"} ] }))</code>
I checked the payload is as expected (with the variables). I get a 400 back on both cases. I also tried to use PATCH user on the developer tools:PATCH user query I get a 400 whatever I do there. Sometimes a CORS error but that's probably unrelated.
Any idea what I'm doing wrong here?
Thanks
tim.smith | 2017-05-16 18:38:05 UTC | #4
A couple things to note:
- There is an known issue where error messages aren't coming back with certain 400 responses, primarily with user updates.
- Your user update requests are missing the version property (send the current version of the user object when updating it)
Once you do send a well-formed request, it looks like the images aren't being saved. I've opened CORE-6615 to address that.
Hugo_Pastore | 2017-05-17 13:12:30 UTC | #5
Thank you, the error went away.
However the picture is not updated on Purecloud... I tried "UserImage" and "images". Is there any limitations regarding profile pictures?
Edit: updating the user's name works fine. Edit2: Sorry I misread your last sentence :) Thanks for the help.
system | 2017-06-17 11:54:16 UTC | #6
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: 1269