Updated on 2022-02-10 GMT+08:00

List Multipart uploads

API Description

You can use this API to list the multipart uploads that are initialized but not combined or aborted in a specified bucket.

Method Definition

1. ObsClient->listMultipartUploads(array $parameter)
2. ObsClient->listMultipartUploadsAsync(array $parameter, callable $callback)

Request Parameter

Field

Type

Optional or Mandatory

Description

Bucket

string

Mandatory

Bucket name

Delimiter

string

Optional

Character used to group object names involved in multipart uploads. If the object name contains the Delimiter parameter, the character string from the first character to the first delimiter in the object name is grouped under a single result element, CommonPrefix. (If a prefix is specified in the request, the prefix must be removed from the object name.)

Prefix

string

Optional

Prefix that the object names in the multipart uploads to be listed must contain

MaxUploads

integer

Optional

Maximum number of returned multipart uploads. The value ranges from 1 to 1000. If the value is not in this range, 1000 is returned by default.

KeyMarker

string

Optional

Object name to start with when listing multipart uploads

UploadIdMarker

string

Optional

Upload ID after which the multipart upload listing begins. It is effective only when used with KeyMarker so that multipart uploads after UploadIdMarker of KeyMarker will be listed.

Returned Result

Field

Type

Description

HttpStatusCode

integer

HTTP status code

Reason

string

Reason description

RequestId

string

Request ID returned by the OBS server

Bucket

string

Bucket name

KeyMarker

string

Object name after which listing multipart uploads begins, which is consistent with that set in the request

UploadIdMarker

string

Upload ID after which the multipart upload listing begins, which is consistent with that set in the request

NextKeyMarker

string

Object name to start with upon the next request for listing multipart uploads

NextUploadIdMarker

string

Upload ID to start with upon the next request for listing multipart uploads. It is used with the NextKeyMarker parameter.

Delimiter

string

Character used to group object names in multipart uploads, which is consistent with that set in the request

Prefix

string

Object name prefix in multipart uploads, which is consistent with the same parameter in the request

MaxUploads

integer

Maximum number of listed multipart uploads, which is consistent with the same parameter in the request

IsTruncated

boolean

Whether all multipart uploads are returned. If the field value is true, not all multipart uploads are returned. If the field value is false, all multipart uploads are returned.

Uploads

indexed array

List of multipart uploads.

  

Key

string

Name of the object to be uploaded

UploadId

string

Multipart upload ID

Initiator

associative array

Initiator of the multipart upload

  

ID

string

ID of the domain to which the initiator belongs

Owner

associative array

Owner of the multipart upload, which is consistent with Initiator

  

ID

string

ID of the domain to which the initiator belongs

Initiated

string

Time when the multipart upload was initiated

  

StorageClass

string

Storage class of the object to be uploaded

CommonPrefixes

indexed array

List of object name prefixes grouped according to the Delimiter parameter (if specified)

  

Prefix

string

Object name prefix grouped according to the Delimiter parameter

Sample Code

try{
       $resp = $obsClient -> listMultipartUploads([
              'Bucket' => 'bucketname',
              'Prefix' => 'prefix',
              'MaxUploads' => 100
       ]);
       printf("RequestId:%s\n", $resp['RequestId']);
       foreach ($resp['Uploads'] as $index => $upload){
              printf("Versions[%d]\n", $index + 1);
              printf("UploadId:%s\n", $upload['UploadId']);
              printf("Initiated:%s\n", $upload['Initiated']);
              printf("StorageClass:%s\n", $upload['StorageClass']);
              printf("Key:%s\n", $upload['Key']);
              printf("Initiator[ID]:%s\n", $upload['Initiator']['ID']);
              printf("Initiator[DisplayName]:%s\n", $upload['Initiator']['DisplayName']);
              printf("Owner[ID]:%s\n", $upload['Owner']['ID']);
              printf("Owner[DisplayName]:%s\n", $upload['Owner']['DisplayName']);
       }
}catch (Obs\Common\ObsException $obsException){
       printf("ExceptionCode:%s\n", $obsException->getExceptionCode());              
       printf("ExceptionMessage:%s\n", $obsException->getExceptionMessage());
}