Queries the versions 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 ListPolicyVersions

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

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:

  • Custom: custom policy
  • System: system policy

Response parameters

Parameter Type Example Description
PolicyVersions Array

The information of the policy versions.

PolicyVersion
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.

VersionId String v3

The ID of the policy version.

RequestId String 7B8A4E7D-6CFF-471D-84DF-195A7A241ECB

The ID of the request.

Examples

Sample requests

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

Sample success responses

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>
            </PolicyVersion>
            <PolicyVersion>
                  <VersionId>v5</VersionId>
                  <IsDefaultVersion>true</IsDefaultVersion>
                  <CreateDate>2015-02-26T01:25:52Z</CreateDate>
            </PolicyVersion>
      </PolicyVersions>
</ListPolicyVersionsResponse>

JSON format

{
    "RequestId": "7B8A4E7D-6CFF-471D-84DF-195A7A241ECB",
    "PolicyVersions": {
        "PolicyVersion": [
            {
                "VersionId": "v3",
                "IsDefaultVersion": false,
                "CreateDate": "2015-01-23T12:33:18Z"
            },
            {
                "VersionId": "v5",
                "IsDefaultVersion": true,
                "CreateDate": "2015-02-26T01:25:52Z"
            }
        ]
    }
}

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.
404 EntityNotExist.Policy The policy does not exist. The error message returned because the policy does not exist.

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