Add or delete tags for a specified topic in batches.
You can add a maximum of 20 tags to a resource.
The API is idempotent. When you are to create tags, if there are duplicate keys in the request body, an error is reported.
If a to-be-created tag has the same key as an existing tag, the tag will be created and overwrite the existing one.
When tags are being deleted and some tags do not exist, the operation is considered successful by default. The character set of the tags will not be checked.
POST /v2/{project_id}/{resource_type}/{resource_id}/tags/action
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID |
resource_type |
Yes |
String |
Resource type Only smn_topic (topic) is supported. |
resource_id |
Yes |
String |
Resource ID Obtain a resource ID:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
tags |
Yes |
Resource_tag structure array |
Tag list. For details, see Table 1. When you delete tags, the tag structure cannot be missing, and the key cannot be left blank or be an empty string. The system does not check the character set when deleting a tag. |
action |
Yes |
String |
Operation to be performed, which can be create or delete |
Parameter |
Type |
Description |
Constraint |
---|---|---|---|
key |
String |
Tag key |
A key can contain up to 36 Unicode characters, including only digits, letters, hyphens (-), and underscores (_). A key cannot be left blank, be an empty string, or start or end with a space. |
value |
String |
Tag value |
A value can contain up to 43 Unicode characters, including only digits, letters, hyphens (-), and underscores (_). A value can be an empty string, but it cannot start or end with a space. |
POST https://{SMN_Endpoint}/v2/{project_id}/{resource_type}/{resource_id}/tags/action
None
See Returned Value.
See Error Codes.