Providing a file via temporary upload

This chapter explains how to make a file temporarily available via temporary upload. Temporary upload is especially useful for large files. Using the (contentLocationUri) URL for the file that was temporarily uploaded, you can then store the DMS object.

Perform the following steps to upload a file temporarily:

  • Determining the URL for a repository

  • Determine the link relation used to temporarily upload the file

  • Open the URL to temporarily upload the file

  • Open the URL to temporarily upload the file (optional)

It is not possible to upload a file temporarily without specifying an ID for a repository.

Determining the URL for a repository

In the chapter Determining a repository, you can learn how to determine the URL for a repository.

Determine the link relation used to temporarily upload the file

You open the URL for a repository as follows:

Request

GET /dms/r/dee1f3d3-eae8-5d9d-84d8-2d758c5ddc27
Accept: application/hal+json

The JSON object for a repository contains the chunkedupload link relation.

Response

{
        "_links": {
                "chunkedupload": {
                        "href": "/dms/r/dee1f3d3-eae8-5d9d-84d8-2d758c5ddc27/blob/chunk/"
                }
        },
        "id": "dee1f3d3-eae8-5d9d-84d8-2d758c5ddc27"
}

Open the URL to temporarily upload the file

Send an HTTP POST request with the binary data as the Body to the URL that you received in the chunkedupload link relation. If successful, you will receive the HTTP status code 201 and the URL (contentLocationUri) in the Location HTTP header.

Request

POST /dms/r/dee1f3d3-eae8-5d9d-84d8-2d758c5ddc27/blob/chunk/
Origin: https://baseuri
Content-Type: application/octet-stream

<binary content>

Response

HTTP/1.1 201 Created
Location: /dms/r/dee1f3d3-eae8-5d9d-84d8-2d758c5ddc27/blob/chunk/2018-01-01_temp_master_file_user1_44f7-95a6-58b8400ecf43

In the HTTP Post request, The whole body is considered as binary data of the file to be uploaded. Currently, the upload using multipart/form-data is not supported.

The maximum size of the body is limited to 100 MB. We recommend a body size of 25 MB. If you want to upload larger files, you can split the file into different chunks. For additional information, see the following section.

Open the URL to temporarily upload the file (optional)

You can divide the upload among multiple HTTP requests in order to avoid a timeout for larger files.

To do so, follow the steps below:

  • Split the file to be uploaded into different chunks.

  • Upload the first chunk as described in "Opening the URL to temporarily upload the file".

  • Upload the next chunk by executing an HTTP POST request on the URL that you received in the header of the response to the first chunk under Location.

  • Repeat the previous step successively for all chunks in the correct order.

Request

POST /dms/r/dee1f3d3-eae8-5d9d-84d8-2d758c5ddc27/blob/chunk/2018-01-01_temp_master_file_user1_44f7-95a6-58b8400ecf43
Content-Type: application/octet-stream

<binary content for chunk>

Response

HTTP/1.1 200 OK

Note the following when uploading multiple chunks:

  • The chunks can only be uploaded sequentially.

  • The order of the HTTP POST request for the chunks must be strictly adhered to.

  • If an error occurs during an HTTP POST request (e.g. HTTP status code is not 200), then you must re-upload the file in all the chunks. Individual chunks cannot be reuploaded.

You receive the following possible responses to the requests:

Status code

Description

200 OK

A chunk was successfully uploaded.

201 Created

The first chunk was successfully uploaded.

404 Not Found

The resource was not found. An unknown repository ID was specified, for example.

500 Internal Server Error

An internal error occurred while processing.