Updated on 2024-06-13 GMT+08:00

Creating a Resource Pool Tag

Function

This API is used to add tags to a specified resource pool. Tags can be added in batches. If a tag to be added has the same key as an existing tag, the tag will overwrite the existing one.

URI

POST /v1/{project_id}/pools/{resource_id}/tags/create

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID and Name.

resource_id

Yes

String

Resource ID, which is the name of the resource pool

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

tags

Yes

Array of Tag objects

List of tags to be added

Table 3 Tag

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key

Minimum: 1

Maximum: 128

value

Yes

String

Tag value

Minimum: 0

Maximum: 255

Response Parameters

Status code: 204

Table 4 Response body parameters

Parameter

Type

Description

tags

Tag object

Resource tag list

Table 5 Tag

Parameter

Type

Description

key

String

Tag key

Minimum: 1

Maximum: 128

value

String

Tag value

Minimum: 0

Maximum: 255

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error codes of ModelArts

error_msg

String

Error message

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error codes of ModelArts

error_msg

String

Error message

Status code: 403

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error codes of ModelArts

error_msg

String

Error message

Status code: 404

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error codes of ModelArts

error_msg

String

Error message

Example Requests

https://{endpoint}/v1/{project_id}/pools/a55eba18-1ebf-4e9a-8229-d2d3b593a3dc/tags/create

{
  "tags" : [ {
    "key" : "test",
    "value" : "service-gpu"
  }, {
    "key" : "model_version",
    "value" : "0.1"
  } ]
}

Example Responses

Status code: 204

Tags added successfully.

{
  "tags" : [ {
    "key" : "test",
    "value" : "service-gpu"
  }, {
    "key" : "model_version",
    "value" : "0.1"
  } ]
}

Status Codes

Status Code

Description

204

Tags added successfully.

400

Invalid parameter.

401

Authentication failed.

403

Insufficient permission.

404

Resource not found.

Error Codes

See Error Codes.