Lists all versions of 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 ListPolicyVersions

The name of this action.

Value: ListPolicyVersions

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
PolicyVersions N/A N/A The list of policy versions.
CreateDate String 2015-02-26T01:25:52Z The date and time when a policy was created.
IsDefaultVersion Boolean false Indicates whether the version is the default version of a policy.
PolicyDocument String { "Statement": [{ "Action": ["oss:*"], "Effect": "Allow", "Resource": ["acs:oss:*:*:*"]}], "Version": "1"} The policy content.
VersionId String v3 The ID of a policy version.
RequestId String 7B8A4E7D-6CFF-471D-84DF-195A7A241ECB The request ID.

Example

Request example

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

Response example

XML format

<ListPolicyVersionsResponse>
  <RequestId>7B8A4E7D-6CFF-471D-84DF-195A7A241ECB</RequestId>
  <PolicyVersions>
    <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>
    <PolicyVersion>
      <VersionId>v5</VersionId>
      <IsDefaultVersion>true</IsDefaultVersion>
      <CreateDate>2015-02-26T01:25:52Z</CreateDate>
      <PolicyDocument>{ "Statement": [{ "Action": ["oss:*"], "Effect": "Allow", "Resource": ["acs:oss:*:*:*"]}], "Version": "1"}</PolicyDocument>
    </PolicyVersion>
  </PolicyVersions>
</ListPolicyVersionsResponse>

JSON format

{
    "RequestId":"7B8A4E7D-6CFF-471D-84DF-195A7A241ECB",
    "PolicyVersions":{
        "PolicyVersion":[
            {
                "IsDefaultVersion":false,
                "VersionId":"v3",
                "PolicyDocument":"{ \"Statement\": [{ \"Action\": [\"oss:*\"], \"Effect\": \"Allow\", \"Resource\": [\"acs:oss:*:*:*\"]}], \"Version\": \"1\"}",
                "CreateDate":"2015-01-23T12:33:18Z"
            },
            {
                "IsDefaultVersion":true,
                "VersionId":"v5",
                "PolicyDocument":"{ \"Statement\": [{ \"Action\": [\"oss:*\"], \"Effect\": \"Allow\", \"Resource\": [\"acs:oss:*:*:*\"]}], \"Version\": \"1\"}",
                "CreateDate":"2015-02-26T01:25:52Z"
            }
        ]
    }
}

Errors

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