Skip to content

IoT File Service – Multi Part Operations

Multi Part Upload

Multi part upload is performed by the following steps:

  1. Initiate multi part upload
  2. Upload file parts
  3. Complete multi part upload

Initiate the File Upload

Initiate a multi part upload by providing the upload=start query parameter to the upload request. The example request below initiates a multi part upload for a file exampleFile in the sub directory optionalDirectory:

1
{{gatewayUrl}}/api/iotfile/v3/files/{{entityId}}/optionalDirectory/exampleFile?upload=start

Upload File Parts

Specify the part number as a query parameter when uploading file parts. The following rules apply for file parts:

  • Part numbers from 1 to 1,000 are accepted and can be uploaded asynchronously.
  • When all parts are uploaded, their part numbers must be sequential.
  • Each part must have a minimum size of 5 MB.
  • Parts belonging to incomplete file uploads are automatically deleted after 2 days.
  • If a part number is used twice, the existing part is overwritten.
1
{{gatewayUrl}}/api/iotfile/v3/files/{{entityId}}/optionalDirectory/exampleFile?part=1

Complete the Upload

Provide the request parameter upload=complete to complete a multi part upload. The example below completes a multi part upload for a file exampleFile in the sub directory optionalDirectory. The complete request accepts a file part that is smaller than the minimum allowed part size and treats it as the final part.

1
{{gatewayUrl}}/api/iotfile/v3/files/{{entityId}}/optionalDirectory/exampleFile?upload=complete

Abort a Multi Part Upload

Abort a multi part upload using the upload=abort parameter. All information for the selected multi part upload is physically deleted.

1
{{gatewayUrl}}/api/iotfile/v3/files/{{entityId}}/optionalDirectory/exampleFile?upload=abort

Multi Part Update

Specify the If-Match header parameter in each request of the multi part upload sequence to update an existing file using multi part upload.

List Current Multi Part Uploads

List the current file parts for a specified file using a GET request to the filelist endpoint.

Each item in the file part list contains:

  • objectKey: The file key consisting of {tenant storage prefix}/{entityId}/{filepath}
  • partNo: The specified multi part number
  • created: UTC time the part was uploaded displayed in milliseconds

Sample request:

1
{{gatewayUrl}}/api/iotfile/v3/fileslist/{{entityId}}/optionalDirectory/exampleFile

Sample response:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
[
    {
        "objectKey": "iotteni/00189ab4c65243bb9d77f17332dd570a/optionalDirectory/exampleFile",
        "partNo": 1,
        "created": 1540509915000
    },
    {
        "objectKey": "iotteni/00189ab4c65243bb9d77f17332dd570a/optionalDirectory/exampleFile",
        "partNo": 2,
        "created": 1540509931000
    }
]

Multi Part Download

Download a portion of an existing using the Range parameter and specify the byte range to download, e.g.: bytes=1-100

Any questions left?

Ask the community


Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.