File uploading

Uploading a file related to a resource is done in three steps:

  1. Get a file URL and corresponding authorized file upload URL
  2. Upload the file
  3. Update the relevant resource property with the file URL

Taking the employee profile picture as an example, the following steps should be done:

  1. 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"
      }
    }
    
  2. Upload the file to the received authorizedUrl

    A PUT request with the binary file in the request body. Also add the the following request header x-ms-blob-type: BlockBlob.

  3. 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.