Uploading a file related to a resource is done in three steps:
- Get a file URL and corresponding authorized file upload URL
- Upload the file
- Update the relevant resource property with the file URL
Taking the employee profile picture as an example, the following steps should be done:
Get a file URL and the corresponding upload authorization using the Get authorized profile picture upload URL endpoint endpoint.
A
GET /employees/profile-picture-url?file-name=my_picture.png
request returns{ "data": { "url": "https://pexipengage.blob.core.windows.net/acme/231734f7-8ac6-4a81-8bf9-9ed9820ccd4f-my_picture.png", "authorizedUrl": "https://pexipengage.blob.core.windows.net/acme/231734f7-8ac6-4a81-8bf9-9ed9820ccd4f-my_picture.png?sv=2019-07-07&ss=b&srt=c&sp=w&se=2023-04-30T00%3A00%3A00Z&st=2023-04-17T00%3A00%3A00Z&spr=https&sig=your_signature" } }
Upload the file to the received
authorizedUrl
A
PUT
request with the binary file in the request body. Also add the the following request headerx-ms-blob-type: BlockBlob
.Update the employee
profilePictureUrl
property using the Update an employee endpoint.A
PATCH /employees/1234
request with request body{ "profilePictureUrl": "https://pexipengage.blob.core.windows.net/acme/231734f7-8ac6-4a81-8bf9-9ed9820ccd4f-my_picture.png" }
which contains the received
url
from the first step.