CompleteMultipartUpload

Last update:2022-03-01 18:22:27

  1. If the user has uploaded all the segments, he can call the merge segment interface, and the system will merge the segments specified by the user into a complete object on the server side. Before performing the “Merge Segment” operation, the user cannot download the uploaded data.

  2. When merging segments, it is necessary to copy the additional message header information recorded during the initialization of the multi-part upload task to the object metadata. The processing process is the same as the processing process of ordinary upload objects with these message headers.

  3. For the uploaded segments, as long as the corresponding multi-segment upload task is not cancelled, the user’s capacity quota will be occupied; after the corresponding multi-segment upload task “merge segments” operation is completed, only the specified multi-segment data will occupy the capacity quota, the other uploaded by the user If the segment data corresponding to this multi-segment task is not included in the segment list established by the “merging segments” operation, the excess segment data will be deleted after the “merging segments” is completed, and the capacity quota will be released at the same time.

  4. The combined multi-part upload data can be downloaded through the existing download object interface to download the entire multi-part upload object.

  5. The merged multi-part upload data can be deleted through the existing delete object interface to delete all the part data of the entire multi-part upload object, and it cannot be restored after deletion.

  6. The merged multi-part upload data does not record the MD5 of the entire object as the Etag. The Etag generation method for the multi-segment data seen by the object in the downloading multi-segment data or the List space is: MD5 (M1M2……MN)-N, where, Mn represents the MD5 value of the nth segment, and N represents the total number of segments.

Request syntax

POST /ObjectName?uploadId=uploadID HTTP/1.1
Host: Bucket.Endpoint
Date: date
Content-Length: length
Authorization: authorization

<CompleteMultipartUpload>
  <Part>
    <PartNumber>partNum1</PartNumber>
    <ETag>etag1</ETag>
  </Part>

  <Part>
    <PartNumber>partNum2</PartNumber>
    <ETag>etag2</ETag>
  </Part>

  <Part>
    <PartNumber>partNum3</PartNumber>
    <ETag>etag3</ETag>
  </Part>
</CompleteMultipartUpload>

URI request parameters

parameter name

description

Is it required

uploadId

Initiate Multipart Upload response upload id

yes

Request header

Only use public request headers .

Request body

The request body is fragment information in xml format

Element name

description

Is it mandatory

CompleteMultipartUpload

List of merged segments.
Type: XML .
Parent: null
child node: one or more Part elements

Yes

Part

A list of elements of an upload segment.
Type: XML
Parent node: CompleteMultipart
Child node: PartNumber, ETag

Yes

PartNumber

Segment number.
Type: integer.
Parent node: Part

Yes

ETag

The ETag value of the corresponding segment .
Type: string.
Parent node: Part

Yes

Response syntax

HTTP/1.1 status_code
x-wos-request-id: request id
Content-Type: application/xml
Content-Length: length
Date: date
Connection: state
Server:WS-web-server

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<CompleteMultipartUploadResult xmlns="https://www.wangsu.com/document">
  <Location>http://example-Bucket.Endpoint/example-Object</Location>
  <Bucket>BucketName</Bucket>
  <Key>ObjectName</Key>
  <ETag>ETag</ETag>
</CompleteMultipartUploadResult>

Response header

Only use public response headers .

Response element

Element

Description

CompleteMultipartUpload

Response container
type: XML
child node: Location, Bucket, Key, ETag
parent node: empty

Location

The url
type of the merged object : string
Parent node: ComleteMultipartUpload

Bucket

The space
type where the merged segment is located : string
Parent node: CompleteMultipartUpload

Key

The key
type of the merged object : string
Parent node: CompleteMultipartUpload

ETag

Result type calculated according to the ETag of each segment
: String
Parent node: CompleteMultipartUpload

Special error

Situation

Http Status

Error Code

Message

The etag value given in the Xml data of the message body is incorrect

400 Bad Request

InvalidPart

One or more of the specified parts could not be found. The part may not have been uploaded, or the specified entity tag may not match the part's entity tag.

Without xml data

400 Bad Request

InvalidRequest

You must specify at least one part

The Xml data format is incorrect, such as missing partNumber tags, etc.

400 Bad Request

MalformedXML

The XML you provided was not well-formed or did not validate against our published schema

Example

POST /example-object?uploadId=AAAsb2FkIElEIGZvciBlbHZpbmcncyWeeS1tb3ZpZS5tMnRzIRRwbG9hZA HTTP/1.1
Host: bucket.s3-cn-east-1.wcsapi.com
Date: Mon, 1 Nov 2020 20:34:56 GMT
Content-Length: 391

Authorization: WOS AKIAIOSFODNN7EXAMPLE:0RQf4/cRonhpaBX5sCYVf1bNRuU=
<CompleteMultipartUpload>
  <Part>
    <PartNumber>1</PartNumber>
    <ETag>"a54357aff0632cce46d942af68356b38"</ETag>
  </Part>
  <Part>
    <PartNumber>2</PartNumber>
    <ETag>"0c78aef83f66abc1fa1e8477f296d394"</ETag>
  </Part>
  <Part>
    <PartNumber>3</PartNumber>
    <ETag>"acbd18db4cc2f85cedef654fccc4a4d8"</ETag>
  </Part>
</CompleteMultipartUpload>


HTTP/1 200 OK
x-wos-request-id: 100315319214214320170602225414pFHJIshn
Access-Control-Allow-Origin: *
Connection: close
Content-Type: application/xml
Content-Length: 301
Date: Mon, 05 Jun 2017 09:56:01 GMT
Server: WS-web-server

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<CompleteMultipartUploadResult xmlns="https://www.wangsu.com/document">
  <Bucket>r28-sync-data</Bucket>
  <ETag>4dc0dc31f93e3f73c52ce251fcdfcaa2-2</ETag>
  <Key>multiobject</Key>
  <Location>http://example-Bucket.Endpoint/example-Object</Location>
</CompleteMultipartUploadResult>

Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!