• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (Node.js SDK)
  4. Bucket-Related APIs
  5. List Multipart uploads

List Multipart uploads

API Description

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

Method Definition

ObsClient.listMultipartUploads(parameter, 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 parameter 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 must be 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 that set in the request

MaxUploads

String

Maximum number of listed multipart uploads, which is consistent with that set in the request

IsTruncated

String

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

Uploads

Array

List of multipart uploads. This field contains the following parameters:

  • Key
  • UploadId
  • Initiator
  • Owner
  • StorageClass
  • Initiated

Key

String

Name of the object to be uploaded

UploadId

String

Multipart upload ID

Initiator

Object

Initiator of the multipart upload

  

Name

String

Initiator name

ID

String

ID of the domain to which the owner belongs

Owner

Object

Owner of the multipart upload. It is the same as the initiator.

  

Name

String

Owner name

ID

String

ID of the domain to which the owner belongs

StorageClass

StorageClass

String

Storage class of the object to be uploaded

Initiated

Initiated

String

Time when the multipart upload was initiated

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
},(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(let 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('Owner[Name]-->' + result.InterfaceResult.Uploads[i]['Owner']['Name']);
                           console.log('Initiator[ID]-->' + result.InterfaceResult.Uploads[i]['Initiator']['ID']);
                           console.log('Initiator[Name]-->' + result.InterfaceResult.Uploads[i]['Initiator']['Name']);
                     }
              }else{
                     console.log('Status-->' + result.CommonMsg.Status);
              }
       }
});