Queries the information of a specified policy version.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | GetPolicyVersion |
The operation that you want to perform. Set the value to GetPolicyVersion. |
PolicyName | String | Yes | OSS-Administrator |
The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-). |
PolicyType | String | Yes | Custom |
The type of the policy. Valid values:
|
VersionId | String | Yes | v3 |
The ID of the policy version. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
PolicyVersion | Struct |
The information of the policy version. |
|
CreateDate | String | 2015-01-23T12:33:18Z |
The time when the policy version was created. |
IsDefaultVersion | Boolean | false |
Indicates whether the policy version is the default version. |
PolicyDocument | String | { \"Statement\": [{ \"Action\": [\"oss:*\"], \"Effect\": \"Allow\", \"Resource\": [\"acs:oss:*:*:*\"]}], \"Version\": \"1\"} |
The document of the policy. |
VersionId | String | v3 |
The ID of the policy version. |
RequestId | String | 9B34724D-54B0-4A51-B34D-4512372FE1BE |
The ID of the request. |
Examples
Sample requests
https://resourcemanager.aliyuncs.com/?Action=GetPolicyVersion
&PolicyName=OSS-Administrator
&PolicyType=Custom
&VersionId=v3
&<Common request parameters>
Sample success responses
XML
format
<GetPolicyVersionResponse>
<RequestId>9B34724D-54B0-4A51-B34D-4512372FE1BE</RequestId>
<PolicyVersion>
<VersionId>v3</VersionId>
<IsDefaultVersion>false</IsDefaultVersion>
<CreateDate>2015-01-23T12:33:18Z</CreateDate>
<PolicyDocument>{ "Statement": [{ "Action": ["oss:*"], "Effect": "Allow", "Resource": ["acs:oss:*:*:*"]}], "Version": "1"}</PolicyDocument>
</PolicyVersion>
</GetPolicyVersionResponse>
JSON
format
{
"RequestId": "9B34724D-54B0-4A51-B34D-4512372FE1BE",
"PolicyVersion": {
"VersionId": "v3",
"IsDefaultVersion": false,
"CreateDate": "2015-01-23T12:33:18Z",
"PolicyDocument": "{ \"Statement\": [{ \"Action\": [\"oss:*\"], \"Effect\": \"Allow\", \"Resource\": [\"acs:oss:*:*:*\"]}], \"Version\": \"1\"}"
}
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidParameter.PolicyType | The specified policy type is invalid. | The error message returned because the policy type is invalid. |
400 | InvalidParameter.PolicyName.InvalidChars | The policy name contains invalid characters. It must only contain upper or lower case letters, numbers, and dash (-). | The error message returned because the policy name contains invalid characters. The policy name can only contain letters, digits, and hyphens (-). |
400 | InvalidParameter.PolicyName.Length | The length of the policy name is invalid. It must be 1 to 64 characters in length. | The error message returned because the length of the policy name is invalid. The policy name must be 1 to 64 characters in length. |
400 | InvalidParameter.VersionId.Format | The specified version ID is invalid. | The error message returned because the format of the policy version ID is invalid. |
404 | EntityNotExist.Policy | The policy does not exist. | The error message returned because the policy does not exist. |
404 | EntityNotExist.Policy.Version | The policy version does not exist. | The error message returned because the policy version does not exist. |
For a list of error codes, visit the API Error Center.