API – Import user photo
Use the API token for authorization. Read more in the article API token
- To import a user photo, you need to send POST request to URI /api/v2/users-import/update-photo
- the request must be accompanied by a file in image format (png, jpg, gif) the uid (External ID) of the user must be specified in the body of the request.
- The request must contain the words Content-Type: multipart/form-data and Authorization: Bearer xxxxxx.
Request example:
curl 'https://your-domain.davintoo.com/api/v2/users-import/update-photo' -H 'Authorization: Bearer xxxxxx' -H 'Content-Type: multipart/form-data' -F 'uid=some-user-uid' -F 'file=@/path/to/photo.jpg'
Instead of a local address https://your-domain.davintoo.com you need to use the address of your instance.
Answer
-
In case of successful request (HTTP response code - 200), there will be reply in JSON format with information about image:
"data":{"name": "image.jpg","size": 37800,"extension":"jpg","width": 180, "height": 180...}
-
In case of error (HTTP response code - 400) it returns JSON object with error information.