Updated on 2022-02-10 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

Request Parameter

Field

Type

Optional or Mandatory

Description

Bucket

String

Mandatory

Bucket name

Key

String

Mandatory

Object 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.

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 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.

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 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

StorageClass

String

Storage class of the object to be uploaded

Sample Code

obsClient.listParts({
       Bucket:'bucketname',
       Key : 'objectkey',
       UploadId : 'uploadid',
       MaxParts : 10
},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);
                     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(var 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);
              }
       }
});