Append Object
API Description
You can use this API to upload an object in appendable mode and append data to the object.
Method Definition
ObsClient.appendObject
Request Parameter
|
Field |
Type |
Optional or Mandatory |
Description |
|---|---|---|---|
|
Bucket |
String |
Mandatory |
Bucket name |
|
Key |
String |
Mandatory |
Object name |
|
Position |
Number |
Mandatory |
Start position for next appending. This parameter must be set to 0 when you create an appendable object. |
|
ACL |
String |
Optional |
Pre-defined access control policy specified during the object creation |
|
StorageClass |
String |
Optional |
Storage class specified during the object creation |
|
Body |
String or stream.Readable |
Optional |
Content of the object to be uploaded. Both character strings and instances of stream.Readable are supported. |
|
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. |
|
SourceFile |
String |
Optional |
Path to the source file of the object |
|
Metadata |
Object |
Optional |
Customized metadata of the object |
|
WebsiteRedirectLocation |
String |
Optional |
Location where the object is redirected to, when the bucket is configured with website hosting |
|
Expires |
Number |
Optional |
Expiration time of the object, in days |
|
SuccessActionRedirect |
String |
Optional |
Redirection address after the upload is successful |
|
ContentType |
String |
Optional |
MIME type of the object |
|
ContentLength |
Number |
Optional |
Object length. This field is effective when SourceFile is set. |
|
ContentMD5 |
String |
Optional |
MD5 value of the object (Base64-encoded). It is provided for the OBS server to verify data integrity. |
|
SseKms |
String |
Optional |
Algorithm used in SSE-KMS encryption. The value can be:
|
|
SseKmsKey |
String |
Optional |
Master key used in SSE-KMS encryption. This field can be null. |
|
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.
Returned Result (InterfaceResult)
|
Field |
Type |
Description |
|---|---|---|
|
RequestId |
String |
Request ID returned by the OBS server |
|
ETag |
String |
Object ETag |
|
NextPosition |
String |
Start position for next appending |
|
StorageClass |
String |
Storage class of the object. When the storage class is OBS Standard, the value is null. |
|
SseKms |
String |
Algorithm used in SSE-KMS decryption |
|
SseKmsKey |
String |
Key used in SSE-KMS encryption |
|
SseC |
String |
Algorithm used in SSE-C decryption |
|
SseCKeyMd5 |
String |
MD5 value of the key used in SSE-C decryption |
Sample Code
obsClient.appendObject({
Bucket : 'bucketname',
Key : 'objectkey',
// SourceFile : 'localfile',
Body : 'Hello OBS',
Position: 0
},(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);
console.log('NextPosition-->' + result.InterfaceResult.NextPosition);
}else{
console.log('Code-->' + result.CommonMsg.Code);
console.log('Message-->' + result.CommonMsg.Message);
}
}
});
Last Article: PUT Object
Next Article: GET Object
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.