• Domain Name Service

dns
  1. Help Center
  2. Domain Name Service
  3. API Reference
  4. API Description
  5. Tag Management
  6. Adding Resource Tags

Adding Resource Tags

Function

Add tags to a specified resource.

You can add a maximum of 10 tags to a resource.

The API is idempotent.

If a to-be-created tag has the same key as an existing tag, the tag will be created and overwrite the existing one.

URI

POST /v2/{project_id}/{resource_type}/{resource_id}/tags

For details, see Table 1.
Table 1 Parameters in the URI

Parameter

Mandatory

Type

Description

project_id

Yes

string

Project ID of the tenant

resource_type

Yes

string

Resource type, which can be DNS-public_zoneDNS-private_zoneDNS-public_recordsetDNS-private_recordset, or DNS-ptr_record

resource_id

Yes

string

Resource ID

Request

  • Parameter description
    Table 2 Parameter in the request

    Parameter

    Mandatory

    Type

    Description

    tag

    Yes

    List<tag>

    Tag

    Table 3 Parameters in the tag list

    Parameter

    Mandatory

    Type

    Description

    key

    Yes

    string

    Tag key, which contains 36 Unicode characters at most and cannot be blank. It can contain only digits, letters, hyphens (-), and underscores (_).

    value

    Yes

    string

    Tag value, which contains 43 Unicode characters at most and can be an empty string. It can contain only digits, letters, hyphens (-), and underscores (_).

  • Example request
    {
        "tag": {
            "key": "key1", 
            "value": "value1"
        }
    }

Response

None

Returned Value

  • Normal
    Table 4 Return code for successful requests

    Returned Value

    Description

    204

    No Content

  • Abnormal
    Table 5 Return code for failed requests

    Returned Value

    Description

    400

    Invalid tag.

    401

    Authentication failed.

    403

    Insufficient permission.

    404

    The requested resource was not found.

    500

    An exception occurs in the system.