Skip to main content

Uploading files

Uploading a file for a placeholder requires using one of the returned uploadEndpoints where the endpointType is HTTP (i.e. 0).

The uploadEndpoints are specified in the response from a Document GET request or from the returned document after a placeholder document is created.

{
"uploadEndpoints": [
{
"location": "https://client-api.phlextmf.com/documents/v5/Files/155",
"endpointType": 0,
"params": {}
}
],
"downloadEndpoints": [
{
"pdfLocation": "https://client-api.phlextmf.com/documents/v5/Files/155?native=false&watermark=false",
"pdfWatermarkLocation": "https://client-api.phlextmf.com/documents/v5/Files/155?native=false&watermark=true",
"nativeLocation": "https://client-api.phlextmf.com/documents/v5/Files/155?native=true",
"endpointType": 0,
"params": null
}
]
}

HTTP Upload

The /documents/v5/files URI is the default endpoint for uploading of files.

Sending a HTTP upload

  1. Create a PUT request to the API's /documents/v5/files URI. For example:

    PUT https://client-api.phlextmf.com/documents/v5/files/{documentId}

  2. Add the following top-level HTTP headers:

    • Content-Type. Set to match the type of file being uploaded,i.e. application/pdf when uploading a PDF.
    • Authorization. Set to the JWT bearer token.
    • Filename. Set to the file name which should be saved to the TMF.
  3. Create the body of the request containing the binary data of the file to upload.

  4. Send the request.

Example of a HTTP upload

PUT /documents/v5/files/155
content-type: application/pdf
authorization: bearer {{auth.response.body.access_token}}
filename: Test.pdf

Binary Data

If the request succeeds, a HTTP 204 status code is returned indicating success.