Obtains information about a policy.

Debug

Use OpenAPI Explorer to perform debug operations and generate SDK code examples.

Request parameters

Parameter Type Required? Example value Description
Action String Yes GetPolicy

The name of this action.

Value: GetPolicy

PolicyName String Yes OSS-Administrator The policy name.
PolicyType String Yes Custom

The policy type.

Valid values: System | Custom

Response parameters

Parameter Type Example value Description
DefaultPolicyVersion N/A N/A The default version of the policy.
CreateDate String 2015-01-23T12:33:18Z The date and time when the policy was created.
IsDefaultVersion Boolean true The returned struct of DefaultPolicyVersion is the default version. Therefore, the value of isDefault is ture.
PolicyDocument String { "Statement": [{ "Action": ["oss:*"], "Effect": "Allow", "Resource": ["acs:oss:*:*:*"]}], "Version": "1"} The policy content.
VersionId String v1 The ID of the policy version.
Policy N/A N/A The information about the policy.
AttachmentCount Integer 0 The number of times that the policy is referenced.
CreateDate String 2015-01-23T12:33:18Z The date and time when the policy was created.
DefaultVersion String v1 The default version.
Description String OSS administrator The policy description.
PolicyDocument String N/A This parameter is invalid.
PolicyName String OSS-Administrator The policy name.
PolicyType String Custom The policy type.
UpdateDate String 2015-01-23T12:33:18Z The date and time when the policy was modified.
RequestId String 697852FB-50D7-44D9-9774-530C31EAC572 The request ID.

Example

Request example

https://ram.aliyuncs.com/?Action=GetPolicy
&PolicyName=OSS-Administrator
&PolicyType=Custom
&<Common parameters>

Response example

XML format

<GetPolicyResponse>
  <RequestId>697852FB-50D7-44D9-9774-530C31EAC572</RequestId>
  <Policy>
    <PolicyName>OSS-Administrator</PolicyName>
    <PolicyType>Custom</PolicyType>
    <Description>OSS administrator</Description>
    <DefaultVersion>v1</DefaultVersion>
    <CreateDate>2015-01-23T12:33:18Z</CreateDate>
    <UpdateDate>2015-01-23T12:33:18Z</UpdateDate>
    <AttachmentCount>0</AttachmentCount>
  </Policy>
  <DefaultPolicyVersion>
    <VersionId>v1</VersionId>
    <IsDefaultVersion>true</IsDefaultVersion>
    <CreateDate>2015-01-23T12:33:18Z</CreateDate>
    <PolicyDocument>{ "Statement": [{ "Action": ["oss:*"], "Effect": "Allow", "Resource": ["acs:oss:*:*:*"]}], "Version": "1"}</PolicyDocument>
  </DefaultPolicyVersion>
</GetPolicyResponse>

JSON format

{
	"Policy":{
		"AttachmentCount":0,
		"Description":"OSS administrator",
		"PolicyName":"OSS-Administrator",
		"UpdateDate":"2015-01-23T12:33:18Z",
		"CreateDate":"2015-01-23T12:33:18Z",
		"DefaultVersion":"v1",
		"PolicyType":"Custom"
	},
	"DefaultPolicyVersion":{
		"IsDefaultVersion":true,
		"VersionId":"v1",
		"PolicyDocument":"{ \"Statement\": [{ \"Action\": [\"oss:*\"], \"Effect\": \"Allow\", \"Resource\": [\"acs:oss:*:*:*\"]}], \"Version\": \"1\"}",
		"CreateDate":"2015-01-23T12:33:18Z"
	},
	"RequestId":"697852FB-50D7-44D9-9774-530C31EAC572"
}

Errors

For a list of error codes, visit the API Error Center.