Updated on 2025-08-28 GMT+08:00

Uploading Multipart

To upload a large file, multipart upload is recommended. Multipart upload is applicable to many scenarios, including:

  • Files to be uploaded are larger than 100 MB.
  • The network condition is poor, causing frequent disconnections from storage servers such as OBS and MinIO.
  • Sizes of files to be uploaded are uncertain.

Multipart upload consists of three steps:

  1. Initializing a Multipart Upload Task: creates a multipart upload task.
  2. Uploading Parts.
  3. Completing Multipart Upload or Terminating (Canceling) a Multipart Upload Task.

    After the upload is complete, the file is stored in the bucket. If you terminate (cancel) a multipart upload task, all uploaded parts will be discarded.

Initializing a Multipart Upload Task

  • Function

    Before uploading data in multipart mode, you must create an initial multipart upload task. This operation will return a globally unique identifier (uploadId) of the task to identify the multipart upload task. You can use the identifier to initiate subsequent operations, such as uploading a multipart upload task, merging parts to complete the upload, and terminating (cancelling) the multipart upload task.

  • URI

    POST Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/{connector_type}/{connector_name}/createmultipartupload?object=X

    Table 1 URI parameters

    Parameter

    Mandatory

    Type

    Description

    connector_type

    Yes

    String

    Explanation

    Type of a connector.

    Constraints

    None

    Value

    • obs: connector for interconnecting with OBS.
    • minio: connector for connecting to MINIO.
    • objectstorageproxy: object storage proxy type.

    Default value

    None

    connector_name

    Yes

    String

    Explanation

    Name of the connector instance, that is, the connector instance name set when the connector is created.

    Constraints

    None

    Value

    None

    Default value

    None

    object

    Yes

    String

    Explanation

    Full path of the file to be uploaded in the bucket, including the file name, file type, and upload path. If no path is specified, the file is uploaded to the root directory of the bucket.

    For example, if the value is a/b/c/test.mp4, the test.mp4 file is uploaded to the a/b/c path of the bucket. If the path does not exist in the bucket, it will be created.

    Constraints

    None

    Value

    None

    Default value

    None

  • Request Parameters
    Table 2 Request header parameters

    Header Field

    Mandatory

    Type

    Description

    Content-Type

    Yes

    String

    Explanation

    Media type of the file to be uploaded. The value must be the same as the file name. For example, if the file name is test.mp4, the value of Content-Type is video/mp4.

    Constraints

    None

    Value

    The values of content-type corresponding to different file types are as follows. The first column indicates the file type, and the second column indicates the corresponding content-type value.

    • 7z: application/x-7z-compressed
    • aac: audio/x-aac
    • ai: application/postscript
    • aif: audio/x-aiff
    • asc: text/plain
    • asf: video/x-ms-asf
    • atom: application/atom+xml
    • avi: video/x-msvideo
    • bmp: image/bmp
    • bz2: application/x-bzip2
    • cer: application/pkix-cert
    • crl: application/pkix-crl
    • crt: application/x-x509-ca-cert
    • css: text/css
    • cs: text/csv
    • cu: application/cu-seeme
    • deb: application/x-debian-package
    • doc: application/msword
    • docx: application/vnd.openxmlformats-officedocument.wordprocessingml.document
    • dvi: application/x-dvi
    • eot: application/vnd.ms-fontobject
    • eps: application/postscript
    • epub: application/epub+zip
    • etx: text/x-setext
    • flac: audio/flac
    • flv: video/x-flv
    • gif: image/gif
    • gz: application/gzip
    • htm: text/html
    • html: text/html
    • ico: image/x-icon
    • ics: text/calendar
    • ini: text/plain
    • iso: application/x-iso9660-image
    • jar: application/java-archive
    • jpe: image/jpeg
    • jpeg: image/jpeg
    • jpg: image/jpeg
    • js: text/javascript
    • json: application/json
    • latex: application/x-latex
    • log: text/plain
    • m4a: audio/mp4
    • m4v: video/mp4
    • mid: audio/midi
    • midi: audio/midi
    • mov: video/quicktime
    • mp3: audio/mpeg
    • mp4: video/mp4
    • mp4a: audio/mp4
    • mp4v: video/mp4
    • mpe: video/mpeg
    • mpeg: video/mpeg
    • mpg: video/mpeg
    • mpg4: video/mp4
    • oga: audio/ogg
    • ogg: audio/ogg
    • ogv: video/ogg
    • ogx: application/ogg
    • pbm: image/x-portable-bitmap
    • pdf: application/pdf
    • pgm: image/x-portable-graymap
    • png: image/png
    • pnm: image/x-portable-anymap
    • ppm: image/x-portable-pixmap
    • ppt: application/vnd.ms-powerpoint
    • pptx: application/vnd.openxmlformats-officedocument.presentationml.presentation
    • ps: application/postscript
    • qt: video/quicktime
    • rar: application/x-rar-compressed
    • ras: image/x-cmu-raster
    • rss: application/rss+xml
    • rtf: application/rtf
    • sgm: text/sgml
    • sgml: text/sgml
    • svg: image/svg+xml
    • swf: application/x-shockwave-flash
    • tar: application/x-tar
    • tif: image/tiff
    • tiff: image/tiff
    • torrent: application/x-bittorrent
    • ttf: application/x-font-ttf
    • txt: text/plain
    • wav: audio/x-wav
    • webm: video/webm
    • wma: audio/x-ms-wma
    • wmv: video/x-ms-wmv
    • woff: application/x-font-woff
    • wsdl: application/wsdl+xml
    • xbm: image/x-xbitmap
    • xls: application/vnd.ms-excel
    • xlsx: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
    • xml: application/xml
    • xpm: image/x-xpixmap
    • xwd: image/x-xwindowdump
    • yaml: text/yaml
    • yml: text/yaml
    • zip: application/zip

    Default value

    None

  • Response Parameters
    Table 3 Response parameters

    Parameter

    Type

    Description

    resCode

    String

    Explanation

    Return code.

    Value

    If the request is successful, 0 is returned. For details about other error codes, see Error Codes.

    resMsg

    String

    Explanation

    Message returned.

    Value

    If the request is successful, "Success" is returned. In other cases, an error message is returned.

    result

    Object

    Explanation

    Object of the created multipart task is returned. The object contains the uploadId field, which indicates the globally unique identifier of the task and is used to identify the multipart upload task. You can use the identifier to initiate subsequent operations, such as uploading a multipart upload task, merging parts to complete the upload, and terminating (canceling) the multipart upload task.

  • Example Request

    An OBS connector has been created. The connector instance name is Namespace_TestOBS. Large files need to be uploaded to the a/b/c path of the OBS bucket. Call the following request to initialize the multipart upload task:

    POST https://Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/obs/Namespace __TestOBS/createmultipartupload?object=a/b/c/test.mp4
  • Example Response
    {
     "resCode": "0",
    	"resMsg": "Success",
     "result": {
      "uploadId": "0000017B761***8FF0F75F13"
     }
    }

    Record the value of uploadId, which is used to identify the multipart upload task and will be used in subsequent operations.

Uploading Parts

  • Function

    After Initializing a Multipart Upload Task, you can upload data by part based on the specified object file name and uploadId. Each uploaded part has a part number, which ranges from 1 to 10000. For the same multipart upload task (with the same uploadId), partNumber not only uniquely identifies a part of data, but also identifies its relative location in the object file. If new data is uploaded using the same part number, the existing data of the part number on the storage server will be overwritten. Except for the last part, the sizes of other parts must be greater than 5 MB. The maximum size of each part is not limited by OBS and MINIO. When this API is called through Huawei Cloud Astro Zero, the maximum size of all parts is 100 MB. Parts can be uploaded in sequence or even on different processes or machines. The storage server sorts the parts by part number to form the final object.

  • URI

    POST Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/{connector_type}/{connector_name}/uploadpart?object=X&uploadId=Y&partNumber=Z

    Table 4 URI parameters

    Parameter

    Mandatory

    Type

    Description

    connector_type

    Yes

    String

    Explanation

    Type of a connector.

    Constraints

    None

    Value

    • obs: connector for interconnecting with OBS.
    • minio: connector for connecting to MINIO.
    • objectstorageproxy: object storage proxy type.

    Default value

    None

    connector_name

    Yes

    String

    Explanation

    Name of the connector instance, that is, the connector instance name set when the connector is created.

    Constraints

    None

    Value

    None

    Default value

    None

    object

    Yes

    String

    Explanation

    Full path of the file to be uploaded in the bucket, including the file name, file type, and upload path. If no path is specified, the file is uploaded to the root directory of the bucket.

    For example, if the value is a/b/c/test.mp4, the test.mp4 file is uploaded to the a/b/c path of the bucket. If the path does not exist in the bucket, it will be created.

    Constraints

    None

    Value

    None

    Default value

    None

    uploadId

    Yes

    String

    Explanation

    Identifier of the multipart upload task. You can obtain the value from the returned result of Initializing a Multipart Upload Task.

    Constraints

    None

    Value

    None

    Default value

    None

    partNumber

    Yes

    Number

    Explanation

    Part number

    For the same multipart upload task (with the same uploadId), partNumber not only uniquely identifies a part of data, but also identifies its relative location in the object file.

    Constraints

    None

    Value

    1–10000

    Default value

    None

  • Request Parameters

    Body type in the request. The file part is uploaded in the application/octet-stream format.

  • Response Parameters
    Table 5 Response parameters

    Parameter

    Type

    Description

    resCode

    String

    Explanation

    Return code.

    Value

    If the request is successful, 0 is returned. For details about other error codes, see Error Codes.

    resMsg

    String

    Explanation

    Message returned.

    Value

    If the request is successful, "Success" is returned. In other cases, an error message is returned.

    result

    Object

    Explanation

    Returned multipart task object, which contains the following fields:

    • ETag: identifier of a file part, which is used for subsequent upload.
    • partNumber: part number, which is used for subsequent upload.
  • Example Request

    An OBS connector has been created. The connector instance name is Namespace_TestOBS. Large files need to be uploaded to the a/b/c path of the OBS bucket. The multipart upload task whose uploadId is 0000017B761F112966C45D8FF0F75F13 has been initialized. Call the following request to create a multipart upload task and upload the test.mp4 file whose part number is 1.

    POST https://Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/obs/Namespace __TestOBS/uploadpart?object=a/b/c/test.mp4&uploadId=0000017B761F112966C45D8FF0F75F13&partNumber=1

    In the request body, set the object in the application/octet-stream format, that is, the file data to be uploaded.

  • Example Response
    {
     "resCode": "0",
    	"resMsg": "Success",
     "result": {
      "ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"",
      "partNumber": 1
     }
    }

    Record the values of ETag and partNumber, which will be used during the upload.

Completing Multipart Upload

  • Function

    After all parts are uploaded, you need to call the upload completion API to merge parts on the storage server (for example, OBS) to generate the final object file. After the upload is complete, you need to provide a list of all valid parts (including partNumber and ETag). After receiving the submitted part list, Huawei Cloud Astro Zero verifies the validity of each part one by one. After all parts pass the verification, these parts are combined into the final object. The merged multipart tasks can have inconsecutive part numbers.

    After the upload is complete, uploadId becomes invalid and cannot be used to terminate (cancel) the multipart upload.

  • URI

    POST Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/{connector_type}/{connector_name}/completeupload?object=X&uploadId=Y

    Table 6 URI parameters

    Parameter

    Mandatory

    Type

    Description

    connector_type

    Yes

    String

    Explanation

    Type of a connector.

    Constraints

    None

    Value

    • obs: connector for interconnecting with OBS.
    • minio: connector for connecting to MINIO.
    • objectstorageproxy: object storage proxy type.

    Default value

    None

    connector_name

    Yes

    String

    Explanation

    Name of the connector instance, that is, the connector instance name set when the connector is created.

    Constraints

    None

    Value

    None

    Default value

    None

    object

    Yes

    String

    Explanation

    Full path of the file to be uploaded in the bucket, including the file name, file type, and upload path. If no path is specified, the file is uploaded to the root directory of the bucket.

    For example, if the value is a/b/c/test.mp4, the test.mp4 file is uploaded to the a/b/c path of the bucket. If the path does not exist in the bucket, it will be created.

    Constraints

    None

    Value

    None

    Default value

    None

    uploadId

    Yes

    String

    Explanation

    Identifier of the multipart upload task. You can obtain the value from the returned result of Initializing a Multipart Upload Task.

    Constraints

    None

    Value

    None

    Default value

    None

  • Request Parameters
    Array type. Each element contains the fields listed in Table 7.
    Table 7 Request parameters

    Parameter

    Mandatory

    Type

    Description

    ETag

    Yes

    String

    Explanation

    Identifier of a file part. Obtain the value from the result returned by Uploading Parts.

    Constraints

    None

    Value

    None

    Default value

    None

    partNumber

    Yes

    String

    Explanation

    Part number

    For the same multipart upload task (with the same uploadId), partNumber not only uniquely identifies a part of data, but also identifies its relative location in the object file. Obtain the value from the returned result in Uploading Parts.

    Constraints

    None

    Value

    1–10000

    Default value

    None

  • Response Parameters
    Table 8 Response parameters

    Parameter

    Type

    Description

    resCode

    String

    Explanation

    Return code.

    Value

    If the request is successful, 0 is returned. For details about other error codes, see Error Codes.

    resMsg

    String

    Explanation

    Message returned.

    Value

    If the request is successful, "Success" is returned. In other cases, an error message is returned.

  • Example Request

    An OBS connector has been created. The connector instance name is Namespace_TestOBS. Large files need to be uploaded to the a/b/c path of the OBS bucket. There are two multipart upload tasks, and uploadId is 0000017B761F112966C45D8FF0F75F13. Call the following request to complete the multipart upload task and merge all parts to generate the final object file.

    POST https://Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/obs/Namespace __TestOBS/completeupload?object=a/b/c/test.mp4&uploadId=0000017B761F112966C45D8FF0F75F13
    
    
    [{
     "ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"",
     "partNumber": 1
    }, {
     "ETag": "\"7dcad0c8a7398333ff25418bad511581\"",
     "partNumber": 2
    }]
  • Example Response
    {
     "resCode": "0",
    	"resMsg": "Success"
    }

Terminating (Canceling) a Multipart Upload Task

  • Function Description

    After a multipart upload task is canceled, you cannot use its uploadId to perform any operation and the uploaded parts will be deleted.

    When a file is being uploaded in multipart mode or fails to be uploaded, parts are generated in the bucket. These parts occupy storage space. You can cancel the multipart upload to delete unnecessary parts to save storage space.

  • URI

    POST Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/{connector_type}/{connector_name}/abortupload?object=X&uploadId=Y

    Table 9 URI parameters

    Parameter

    Mandatory

    Type

    Description

    connector_type

    Yes

    String

    Explanation

    Type of a connector.

    Constraints

    None

    Value

    • obs: connector for interconnecting with OBS.
    • minio: connector for connecting to MINIO.
    • objectstorageproxy: object storage proxy type.

    Default value

    None

    connector_name

    Yes

    String

    Explanation

    Name of the connector instance, that is, the connector instance name set when the connector is created.

    Constraints

    None

    Value

    None

    Default value

    None

    object

    Yes

    String

    Explanation

    Full path of the file to be uploaded in the bucket, including the file name, file type, and upload path. If no path is specified, the file is uploaded to the root directory of the bucket.

    For example, if the value is a/b/c/test.mp4, the test.mp4 file is uploaded to the a/b/c path of the bucket. If the path does not exist in the bucket, it will be created.

    Constraints

    None

    Value

    None

    Default value

    None

    uploadId

    Yes

    String

    Explanation

    Identifier of the multipart upload task. You can obtain the value from the returned result of Initializing a Multipart Upload Task.

    Constraints

    None

    Value

    None

    Default value

    None

  • Request Parameters

    None

  • Response Parameters
    Table 10 Response parameters

    Parameter

    Type

    Description

    resCode

    String

    Explanation

    Return code.

    Value

    If the request is successful, 0 is returned. For details about other error codes, see Error Codes.

    resMsg

    String

    Explanation

    Message returned.

    Value

    If the request is successful, "Success" is returned. In other cases, an error message is returned.

  • Example Request

    An OBS connector has been created. The connector instance name is Namespace_TestOBS. Large files need to be uploaded to the a/b/c path of the OBS bucket. If the uploadId is 0000017B76500F0662CABA7128913936, call the following request to cancel the multipart upload task:

    POST https://Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/obs/Namespace __TestOBS/abortupload?object=a/b/c/test3.mp4&uploadId=0000017B76500F0662CABA7128913936
  • Example Response
    {
     "resCode": "0",
    	"resMsg": "Success"
    }