Add Tags to a Task Definition
Endpoint: POST /api/metadata/task/{taskName}/tags
Adds tags to a task definition. You can add a single tag or multiple tags in one request. If a tag with the same key already exists, this operation will update its value.
Path Parameters
| Parameter | Description | Type | Required/ Optional |
|---|---|---|---|
| taskName | The name of the task definition to which the tags are to be added. | string | Required. |
Request Body
The request body should be a JSON object where each key-value pair represents a tag.
| Parameter | Description | Type | Required/ Optional |
|---|---|---|---|
| key | The tag key. | string | Required. |
| value | The tag value. | string | Required. |
To add multiple tags in a single request, include multiple key-value pairs in the same object. For example:
{
"key": "environment",
"value": "production",
"key": "team",
"value": "backend"
}
Response
- Returns 200 OK, indicating that tags have been added to the task definition.
- Returns 404 if the task definition does not exist.
Examples
Add a single tag to a task definition
Request
curl -X 'POST' \
'https://<YOUR-CLUSTER>/api/metadata/task/simple/tags' \
-H 'accept: */*' \
-H 'X-Authorization: <TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"key": "environment",
"value": "production"
}'
Response
Returns 200 OK, indicating that the tag has been added to the task definition.
Add multiple tags to a task definition
Request
curl -X 'POST' \
'https://<YOUR-CLUSTER>/api/metadata/task/simple/tags' \
-H 'accept: */*' \
-H 'X-Authorization: <TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"key": "environment",
"value": "production",
"key": "team",
"value": "backend"
}'
Response
Returns 200 OK, indicating that tags have been added to the task definition.