OBS BrowserJS SDK
OBS BrowserJS SDK
-
API Reference
- Overview
- Initialization
- Pre-defined Constants
-
Bucket-Related APIs
- Before You Start
- HEAD Bucket
- DELETE Bucket
- GET Objects
- GET Object versions
- List Multipart uploads
- Obtain Bucket Metadata
- GET Bucket location
- GET Bucket storageinfo
- PUT Bucket quota
- GET Bucket quota
- Set Bucket storagePolicy
- GET Bucket storagePolicy
- PUT Bucket acl
- GET Bucket acl
- PUT Bucket logging
- GET Bucket logging
- PUT Bucket policy
- GET Bucket policy
- DELETE Bucket policy
- PUT Bucket lifecycle
- GET Bucket lifecycle
- DELETE Bucket lifecycle
- PUT Bucket website
- GET Bucket website
- DELETE Bucket website
- PUT Bucket versioning
- GET Bucket versioning
- GET Bucket cors
- DELETE Bucket cors
- PUT Bucket tagging
- GET Bucket tagging
- DELETE Bucket tagging
- Object-Related APIs
- Other APIs
- Change History
- General Reference
On this page
Show all
Help Center/
OBS BrowserJS SDK/
API Reference/
Initialization/
Result Returned via the Promise Object
Copied.
Result Returned via the Promise Object
Description
ObsClient supports results returned via the Promise object. If no exception is caught by the catch method of the Promise object, the API calling is complete. In such conditions, you need to obtain the HTTP status code from the SDK common result object to check whether the operation is successful.
Sample Code
obsClient.putObject({ Bucket : 'bucketname', Key : 'objectkey', Body : 'Hello OBS' }).then(function(result) { if(result.CommonMsg.Status < 300){ if(result.InterfaceResult){ console.log('Operation Succeed'); } }else{ console.log('Code-->' + result.CommonMsg.Code); console.log('Message-->' + result.CommonMsg.Message); console.log('HostId-->' + result.CommonMsg.HostId); console.log('RequestId-->' + result.CommonMsg.RequestId); } }).catch(function(err) { console.error('Error-->' + err); });
Parent topic: Initialization
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot