Sets the default version for 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 SetDefaultPolicyVersion

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

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 (-).

VersionId String Yes v2

The ID of the policy version.

Response parameters

Parameter Type Example Description
RequestId String 9B34724D-54B0-4A51-B34D-4512372FE1BE

The ID of the request.

Examples

Sample requests

https://resourcemanager.aliyuncs.com/?Action=SetDefaultPolicyVersion
&PolicyName=OSS-Administrator
&VersionId=v2
&<Common request parameters>

Sample success responses

XML format

<SetDefaultPolicyVersionResponse>
      <RequestId>9B34724D-54B0-4A51-B34D-4512372FE1BE</RequestId>
</SetDefaultPolicyVersionResponse>

JSON format

{
    "RequestId": "9B34724D-54B0-4A51-B34D-4512372FE1BE"
}

Error codes

HTTP status code Error code Error message Description
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.