This API is used to add tags to, update tags of, or delete tags from an image in a batch.
If a tag to be added has the same key as an existing tag, but the tag values are different, this tag will be added and overwrite the existing one. If a tag to be added has the same key and value as an existing tag, this tag will not be added.
If the specified tag does not exist, the deletion is considered successful by default.
The system does not check characters of keys and values. A key cannot be left blank or be an empty string. Values are optional for keys. If a tag to be deleted does not exist, the system considers that it has been deleted. No error will be reported. The system will check key and value lengths. A key can contain a maximum of 127 characters, and a value can contain a maximum of 255 characters.
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
tags |
Yes |
Array of objects |
Lists the tags to be added or deleted. For details, see Table 2. |
action |
Yes |
String |
Specifies the tag operation to be performed. The value is case sensitive and can be create or delete. create indicates that tags will be added or updated, while delete indicates that tags will be deleted. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | POST https://{Endpoint}/v2/fd73a4a14a4a4dfb9771a8475e5198ea/images/67e17426-359e-49fb-aa12-0bd1756ec240/tags/action { "tags": [{ "value": "value1", "key": "key1" }, { "value": "value2", "key": "key2" }, { "value": "", "key": "key3" }], "action": "create" } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | POST https://{Endpoint}/v2/fd73a4a14a4a4dfb9771a8475e5198ea/images/67e17426-359e-49fb-aa12-0bd1756ec240/tags/action { "tags": [{ "value": "value1", "key": "key1" }, { "value": "value2", "key": "key2" }, { "value": "", "key": "key3" }], "action": "delete" } |