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

ObsClient.listMultipartUploads

Request Parameter

Field

Type

Optional or Mandatory

Description

Bucket

String

Mandatory

Bucket name

RequestDate

String

or

Date

Optional

Request time

NOTE:

When the parameter type is String, the value must comply with the ISO8601 or RFC822 standards.

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

Number

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 (InterfaceResult)

Field

Type

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

String

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

IsTruncated

String

Whether all versioning objects are returned. If the field value is true, not all versioning objects are returned. If the field value is false, all versioning objects are returned.

Uploads

Array

List of multipart uploads

  

Key

String

Name of the object to be uploaded

UploadId

String

Multipart upload ID

Initiator

Object

Initiator of the multipart upload

  

ID

String

ID of the domain to which the initiator belongs

Owner

Object

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

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

obsClient.listMultipartUploads ({
       Bucket : 'bucketname',
       Prefix : 'prefix',
       MaxUploads : 100
},function (err, result) {
       if(err){
              console.error('Error-->' + err);
       }else{
              if(result.CommonMsg.Status < 300){
                     console.log('RequestId-->' + result.InterfaceResult.RequestId);
                     console.log('Bucket-->' + result.InterfaceResult.Bucket);
                     for(var i=0;i<result.InterfaceResult.Uploads.length;i++){
                           console.log('Uploads[' + i + ']');
                           console.log('UploadId-->' + result.InterfaceResult.Uploads[i]['UploadId']);
                           console.log('Key-->' + result.InterfaceResult.Uploads[i]['Key']);
                           console.log('Initiated-->' + result.InterfaceResult.Uploads[i]['Initiated']);
                           console.log('StorageClass-->' + result.InterfaceResult.Uploads[i]['StorageClass']);
                           console.log('Owner[ID]-->' + result.InterfaceResult.Uploads[i]['Owner']['ID']);
                           console.log('Initiator[ID]-->' + result.InterfaceResult.Uploads[i]['Initiator']['ID']);
                     }
              }else{
                     console.log('Code-->' + result.CommonMsg.Code);
                     console.log('Message-->' + result.CommonMsg.Message);
              }
       }
});