Deletes a version of a permission policy.

Note The default version of a permission policy cannot be deleted.

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 DeletePolicyVersion

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

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 v3

The ID of the policy version.

You can call the ListPolicyVersions operation to query the ID.

For more information about common request parameters, see Common parameters.

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=DeletePolicyVersion
&PolicyName=OSS-Administrator
&VersionId=v3
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<?xml version="1.0" encoding="UTF-8" ?>
<DeletePolicyVersionResponse>
		<RequestId>9B34724D-54B0-4A51-B34D-4512372FE1BE</RequestId>
</DeletePolicyVersionResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "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 contain only letters, digits, and hyphens (-).
400 InvalidParameter.PolicyName.Length The length of the policy name is invalid. It must be 1 to 128 characters in length. The error message returned because the length of the policy name is invalid. The policy name must be 1 to 128 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.
409 DeleteConflict.Policy.Version.Default You cannot delete the default policy version. The error message returned because the policy version is the default version and cannot be deleted.

For a list of error codes, see Service error codes.