PUT Part
API Description
After the multipart upload is initialized, you can use this API to upload a part to a specified bucket by using the multipart upload ID. Except for the part last uploaded whose size ranges from 0 to 5 GB, sizes of the other parts range from 100 KB to 5 GB. The upload part ID ranges from 1 to 10000.
Method Definition
ObsClient.uploadPart
Request Parameter
Field |
Type |
Optional or Mandatory |
Description |
---|---|---|---|
Bucket |
String |
Mandatory |
Bucket name |
Key |
String |
Mandatory |
Object name |
PartNumber |
Number |
Mandatory |
Part number, which ranges from 1 to 10000 |
UploadId |
String |
Mandatory |
Multipart upload ID |
ContentMD5 |
String |
Optional |
Base64-encoded MD5 value of the part to be uploaded. It is provided for the OBS server to verify data integrity. |
Body |
String or stream.Readable |
Optional |
Content of the part. Both character strings and instances of stream.Readable are supported. |
SourceFile |
String |
Optional |
Path to the source file of the part |
Offset |
Number |
Optional |
Start offset (in bytes) of a part in the source file. This field is effective when SourceFile is set and its default value is 0. |
PartSize |
Number |
Optional |
Size (in bytes) of a part in the source file. This field is effective when SourceFile is set and its default value is file size minus Offset. Except for the part lastly being uploaded whose size ranging from 0 to 5 GB, sizes of the other parts range from 100 KB to 5 GB. |
SseC |
String |
Optional |
Algorithm used in SSE-C encryption. The value can be:
|
SseCKey |
Buffer |
Optional |
Key used to encrypt the object in SSE-C mode, which is calculated by using AES256 |
- Body and SourceFile cannot be used together.
- If both Body and SourceFile are null, the size of the uploaded object is 0 bytes.
- Offset, PartSize, and SourceFile can be used together to specify a part data in the to-be-uploaded source file.
Returned Result (InterfaceResult)
Field |
Type |
Description |
---|---|---|
RequestId |
String |
Request ID returned by the OBS server |
ETag |
String |
ETag of current upload part |
SseKms |
String |
Algorithm used in SSE-KMS encryption |
SseKmsKey |
String |
Key used in SSE-KMS encryption |
SseC |
String |
Algorithm used in SSE-C encryption |
SseCKeyMd5 |
String |
MD5 value of the key used in SSE-C encryption |
Sample Code
obsClient.uploadPart({ Bucket:'bucketname', Key : 'objectkey', UploadId : 'uploadid', PartNumber : 1, Body : 'Hello OBS' },(err, result) => { if(err){ console.error('Error-->' + err); }else{ if(result.CommonMsg.Status < 300){ console.log('RequestId-->' + result.InterfaceResult.RequestId); console.log('ETag-->' + result.InterfaceResult.ETag); }else{ console.log('Code-->' + result.CommonMsg.Code); console.log('Message-->' + result.CommonMsg.Message); } } });
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.