Creates preset tags.
A preset tag is a tag that you create in advance and is added to the resources in all regions. You can create preset tags in the stage of tag planning and add them to cloud resources in the stage of tag implementation. When you create a preset tag, you can specify only the tag key. You can specify a tag value in the future.
In this example, a preset tag whose tag key is Environment
is created to indicate the business environment.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateTags |
The operation that you want to perform. Set the value to CreateTags. |
RegionId | String | Yes | cn-hangzhou |
The region ID. For more information about the region ID, see Endpoints. |
TagKeyValueParamList.N.Key | String | Yes | Environment |
The tag key. The tag key must be 1 to 128 characters in length and cannot contain Valid values of N: 1 to 10. |
TagKeyValueParamList.N.TagValueParamList.N.Value | String | No | test |
The tag value. The tag value must be 1 to 128 characters in length and cannot contain Valid values of N: 1 to 10. |
TagKeyValueParamList.N.TagValueParamList.N.Description | String | No | Test environment |
The description of the tag value. Valid values of N: 1 to 10. |
TagKeyValueParamList.N.Description | String | No | Business environment |
The description of the tag key. Valid values of N: 1 to 10. |
For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 94E16BB6-3FB6-1297-B5B2-ED2250F437CD |
The ID of the request. |
Examples
Sample requests
https://tag.aliyuncs.com/?Action=CreateTags
&RegionId=cn-hangzhou
&TagKeyValueParamList.1.Key=Environment
&<Common request parameters>
Sample success responses
XML
format
<CreateTagsResponse>
<RequestId>94E16BB6-3FB6-1297-B5B2-ED2250F437CD</RequestId>
</CreateTagsResponse>
JSON
format
{
"RequestId": "94E16BB6-3FB6-1297-B5B2-ED2250F437CD"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
403 | WrongEndpoint | Only the central endpoint supports the create and delete operation of meta tag. | The error message returned because the specified endpoint is invalid. Use the endpoint hub. You can use only the endpoint hub to create or delete a preset tag. |
403 | InvalidParameter.Key | The Key is invalid. | The error message returned because the specified tag key is invalid. |
403 | InvalidParameter.Value | The Value is invalid. | The error message returned because the specified tag value is invalid. |
404 | MissingParameter.TagKeyValueParamList | The parameter TagKeyValueParamList must not be null. | The error message returned because the TagKeyValueParamList parameter is not specified. |
404 | MissingParameter.Key | The Key must not be empty. | The error message returned because no tag key is specified. |
404 | MissingParameter.Value | The Value must not be empty. | The error message returned because no tag value is specified. |
For a list of error codes, visit the API Error Center.