Skip to content

Create multipart file

A multipart upload allows a file to be uploaded in parts. Multipart uploads are resumable uploads.

After each part is uploaded, the complete action recompiles the parts. The file then becomes accessible under a unique file ID and path, with a single URL for downloading.

  • The minimum size for a multipart upload part is 5 MB (except for the last part, which may be less than 5 MB).
  • The maximum part size is 5 GB.
  • The number of parts of a multipart upload cannot exceed 10,000.
  • A space should be created. To know more about creating a space refer here
  • File needs to be segregated for multipart upload.

Use the following steps to upload a multipart file to File service.

The steps below provide an outline. See File service API definition for parameter details.

POST {baseUrl}/spaces/{spaceId}/uploads
  • HEADER:

    • Authorization: Bearer {tid token}
  • BODY:

    • name - Name of file
    • parentId - Parent id for the file where it needs to be created
    • multipart - Boolean value to indicate if the file needs to be created as a multipart file

After the upload operation is completed, the JSON response includes the id value for the file and URLs for your file upload.

There is a query string parameter “partNumber=*” in the upload URL from the previous request. Substitute the “*” value with the number of the current part that needs to be uploaded.

Separate the file into parts, and upload each to the URL with parameter value substituted. Part numbering starts with "1" (not zero).

PUT {UPLOAD URL}
  • BODY
{PART DATA}

Response will include an ETag in the header. Keep track of the ETag responses for each upload.

After all parts are uploaded, run the API call to complete the multipart upload. Use the upload id from the first step.

PATCH /spaces/{spaceId}/uploads/{uploadId}
  • HEADER:

    • Authorization: Bearer {tid token}
  • BODY:

    • etag - ETag generated from aws
    • partNumber - Part number of the uploaded file

Run a GET upload API call to check the job status. The value should be COMPLETED.

GET {baseUrl}/spaces/{spaceId}/uploads/{uploadId}
  • HEADER:

    • Authorization: Bearer {tid token}

To know more about the upload multipart API refer here.