DELETE Object
API Description
You can use this API to delete an object from a specified bucket.
Method Definition
1. ObsClient->deleteObject(array $parameter) 2. ObsClient->deleteObjectAsync(array $parameter, callable $callback)
Request Parameter
Field | Type | Optional or Mandatory | Description |
|---|---|---|---|
Bucket | string | Mandatory | Bucket name |
Key | string | Mandatory | Object name |
VersionId | string | Optional | Version ID of the object to be deleted |
Returned Result
Field | Type | Description |
|---|---|---|
HttpStatusCode | integer | HTTP status code |
Reason | string | Reason description |
RequestId | string | Request ID returned by the OBS server |
DeleteMarker | boolean | Whether the deleted object is a delete marker |
VersionId | string | Version ID of the object to be deleted |
Sample Code
try{ $resp = $obsClient -> deleteObject([ 'Bucket' => 'bucketname', 'Key' => 'objectkey' ]); printf("RequestId:%s\n", $resp['RequestId']); }catch (Obs\Common\ObsException $obsException){ printf("ExceptionCode:%s\n", $obsException->getExceptionCode()); printf("ExceptionMessage:%s\n", $obsException->getExceptionMessage()); }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.

