Updated on 2023-03-16 GMT+08:00

List Parts

API Description

You can use this API to list the uploaded parts in a specified bucket by using the multipart upload ID.

Method Definition

ObsClient.listParts(parameter, callback)

Request Parameter

Field

Type

Optional or Mandatory

Description

Bucket

String

Mandatory

Bucket name

Key

String

Mandatory

Object name

UploadId

String

Mandatory

Multipart upload ID

MaxParts

Number

Optional

Maximum number of uploaded parts that can be listed per page

PartNumberMarker

Number

Optional

Part number after which listing uploaded parts begins. Only parts whose part numbers are larger than this value will be listed.

Returned Result (InterfaceResult)

Field

Type

Description

RequestId

String

Request ID returned by the OBS server

Bucket

String

Bucket name

Key

String

Object name

UploadId

String

Multipart upload ID

PartNumberMarker

String

Part number after which the listing uploaded parts begins, which is consistent with that set in the request

NextPartNumberMarker

String

Part number to start with upon the next request for listing uploaded parts

MaxParts

String

Maximum number of listed parts, 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.

Parts

Array

List of uploaded parts

  

PartNumber

String

Part number

LastModified

String

Time when the part was last modified

ETag

String

Part ETag

Size

String

Part size

Initiator

Object

Initiator of the multipart upload

  

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.

  

ID

String

ID of the domain to which the owner belongs

StorageClass

String

Storage class of the object to be uploaded

Sample Code

obsClient.listParts({
       Bucket:'bucketname',
       Key : 'objectkey',
       UploadId : 'uploadid',
       MaxParts : 10
},(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);
                     console.log('Key-->' + result.InterfaceResult.Key);
                     console.log('UploadId-->' + result.InterfaceResult.UploadId);
                     console.log('PartNumberMarker-->' + result.InterfaceResult.PartNumberMarker);
                     console.log('NextPartNumberMarker-->' + result.InterfaceResult.NextPartNumberMarker);
                     console.log('MaxParts-->' + result.InterfaceResult.MaxParts);
                     console.log('IsTruncated-->' + result.InterfaceResult.IsTruncated);
                     console.log('StorageClass-->' + result.InterfaceResult.StorageClass);
                     console.log('Initiator[ID]-->' + result.InterfaceResult.Initiator['ID']);
                     console.log('Owner[ID]-->' + result.InterfaceResult.Owner['ID']);
                     for(let i=0;i<result.InterfaceResult.Parts.length;i++){
                           console.log('Part['+i+']:');
                           console.log('PartNumber-->' + result.InterfaceResult.Parts[i]['PartNumber']);
                           console.log('LastModified-->' + result.InterfaceResult.Parts[i]['LastModified']);
                           console.log('ETag-->' + result.InterfaceResult.Parts[i]['ETag']);
                           console.log('Size-->' + result.InterfaceResult.Parts[i]['Size']);
                     }
              }else{
                     console.log('Code-->' + result.CommonMsg.Code);
                     console.log('Message-->' + result.CommonMsg.Message);
              }
       }
});