Queries the information of a policy.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes GetPolicy

The operation that you want to perform. Set the value to GetPolicy.

PolicyName String Yes OSS-Administrator

The name of the policy.

PolicyType String Yes Custom

The type of the policy. Valid values: System and Custom.

Response parameters

Parameter Type Example Description
DefaultPolicyVersion Struct

The information of the default policy version.

CreateDate String 2015-01-23T12:33:18Z

The time when the default policy version was created.

IsDefaultVersion Boolean true

An attribute in the DefaultPolicyVersion parameter. The value of the IsDefaultVersion parameter is true.

PolicyDocument String { "Statement": [{ "Action": ["oss:*"], "Effect": "Allow", "Resource": ["acs:oss:*:*:*"]}], "Version": "1"}

The script of the default policy version.

VersionId String v1

The ID of the default policy version.

Policy Struct

The basic information of the policy.

AttachmentCount Integer 0

The number of references to the policy.

CreateDate String 2015-01-23T12:33:18Z

The time when the policy was created.

DefaultVersion String v1

The default version ID of the policy.

Description String OSS administrator

The description of the policy.

PolicyDocument String N/A

This parameter is deprecated.

PolicyName String OSS-Administrator

The name of the policy.

PolicyType String Custom

The type of the policy.

UpdateDate String 2015-01-23T12:33:18Z

The time when the policy was modified.

RequestId String 697852FB-50D7-44D9-9774-530C31EAC572

The ID of the request.

Examples

Sample requests

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

Sample success responses

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

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

Error codes

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