• Distributed Message Service

dms
  1. Help Center
  2. Distributed Message Service
  3. API Reference
  4. APIs for Managing Queue Tags
  5. Adding and Deleting Queue Tags in Batches

Adding and Deleting Queue Tags in Batches

Function

  • This API is used to add or delete tags in batches for a specified queue.
  • A maximum of 10 tags can be added to a queue.
  • This API is idempotent.
  • When tags are added in batches, if the request body contains duplicated keys, an error message will be reported.
  • When tags are added in batches, if tags with the same key already exist, the existing tags will be overwritten.
  • After tags are deleted in batches, if the tags do not exist, they have been successfully deleted by default.
  • When tags are deleted in batches, their keys cannot be empty or empty strings, and cannot exceed 36 Unicode characters. In addition, their values cannot exceed 43 Unicode characters. Otherwise, status code 400 is returned.

URI

URI format: POST /v1.0/{project_id}/queue/{queue_id}/tags/action

Table 1 Request header

Parameter

Description

Mandatory or Not

Example

Content-type

Indicates the MIME types of a request body.

Yes

application/json

X-Auth-Token

Indicates the user token.

Yes

-

Table 2 Parameter description

Parameter

Mandatory or Not

Type

Description

project_id

Yes

String

Indicates the ID of a project.

queue_id

Yes

String

Indicates the queue ID.

Example

/v1.0/67c01b92944144a19d2da968ef34a912/queue/dd713484-e0b6-4e70-9942-4250e773d17c/tags/action

Request

Table 3 and Table 4 describe the parameters.
Table 3 Parameter description

Parameter

Mandatory or Not

Type

Description

tags

Yes

Array

Indicates a list of tags.

action

Yes

String

Indicates an operation, which can be create or delete.

Table 4 tags parameter description

Parameter

Mandatory or Not

Type

Description

key

Yes

String

Indicates a tag key, which can contain a maximum of 36 Unicode characters. It cannot be empty and cannot contain nonprintable ASCII (0–31) characters and the following special characters: =*<>\,|/

value

No

String

Indicates a tag value. A tag value can contain a maximum of 43 Unicode characters. It can be an empty string and cannot contain nonprintable ASCII (0–31) characters and the following special characters: =*<>\,|/

When tags are deleted in batches, if both keys and values are specified, tags containing the specified keys and values are deleted; if keys are specified but values are not specified, tags containing the specified keys are deleted.

Example request

{
    "action": "create",
    "tags": [
        {
            "key": "key1",
            "value": "value1"
        },
        {
            "key": "key",
            "value": "value3"
        }
    ]
}

Or

{
    "action": "delete",
    "tags": [
        {
            "key": "key1"
         },
        {
            "key": "key2",
            "value": "value3"
        }
    ]
}

Response

Response parameters

None.

Example response

None.

Status Code

Status Code

Description

204

No content

400

Invalid parameters, such as tag.

401

Authentication failed.

403

Insufficient permission.

404

No queue found.

500

System error.