GET Object acl
API Description
You can use this API to obtain an object ACL in a specified bucket.
Method Definition
1. ObsClient->getObjectAcl(array $parameter) 2. ObsClient->getObjectAclAsync(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 | Object version ID |
Returned Result
| Field | Type | Description | ||
|---|---|---|---|---|
| HttpStatusCode | integer | HTTP status code | ||
| Reason | string | Reason description | ||
| RequestId | string | Request ID returned by the OBS server | ||
| VersionId | string | Object version ID | ||
| Owner | associative array | Object owner | ||
| ID | string | ID of the domain to which the object owner belongs | ||
| Delivered | boolean | Whether the bucket ACL is applied to objects in the bucket | ||
| Grants | indexed array | List of grantees' permission information | ||
| Grantee | associative array | Grantee | ||
| ID | string | ID of the domain to which the grantee belongs. This field is null when Type of Grantee is Group. | ||
| URI | string | Grantee group. This field is null when Type of Grantee is CanonicalUser. | ||
| Permission | string | Granted permission | ||
Sample Code
try {
$resp = $obsClient->getObjectAcl( [
'Bucket' => 'bucketname',
'Key' => 'objectkey'
] );
printf ( "RequestId:%s\n", $resp ['RequestId'] );
printf("Owner[ID]:%s\n", $resp['Owner']['ID']);
printf("Grants\n");
foreach ($resp['Grants'] as $index => $grant){
printf("Grants[%d]", $index + 1);
printf("Grantee[ID]:%s\n", $grant['Grantee']['ID']);
printf("Grantee[URI]:%s\n", $grant['Grantee']['URI']);
printf("Permission:%s\n", $grant['Permission']);
}
} catch ( Obs\Common\ObsException $obsException ) {
printf ( "ExceptionCode:%s\n", $obsException->getExceptionCode () );
printf ( "ExceptionMessage:%s\n", $obsException->getExceptionMessage () );
} Last Article: PUT Object acl
Next Article: Initiate Multipart Upload
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.