Skip to main content

Replace Tags in a Task Definition

Endpoint: PUT /api/metadata/task/{taskName}/tags

Replaces all existing tags in a task definition with the new tags provided in the request. If the task definition has multiple tags, they will all be replaced with the tags specified in the request body.

Path Parameters

ParameterDescriptionTypeRequired/ Optional
taskNameThe name of the task definition in which the tags are to be replaced.stringRequired.

Request Body

The request body should be an array of tag objects.

ParameterDescriptionTypeRequired/ Optional
keyThe tag key.stringRequired.
valueThe tag value.stringRequired.

Response

  • Returns 200 OK, indicating that the tag has been replaced in the task definition.
  • Returns 404 if the task definition does not exist.

Examples

Replace a tag from a task definition

Request

curl -X 'PUT' \
'https://<YOUR-CLUSTER>/api/metadata/task/simple/tags' \
-H 'accept: */*' \
-H 'X-Authorization: <TOKEN>' \
-H 'Content-Type: application/json' \
-d '[
{
"key": "environment",
"value": "testing"
}
]'

Response

Returns 200 OK, indicating that the tag has been replaced in the task definition.

Replace with multiple tags in a task definition

Request

curl -X 'PUT' \
'https://<YOUR-CLUSTER>/api/metadata/task/simple/tags' \
-H 'accept: */*' \
-H 'X-Authorization: <TOKEN>' \
-H 'Content-Type: application/json' \
-d '[
{
"key": "env",
"value": "prod"
},
{
"key": "team",
"value": "backend"
}
]
]'

Response

Returns 200 OK, indicating that the tags have been replaced in the task definition.