Add or Replace Tags in Gateway Service Routes
Endpoint: PUT /api/gateway/config/services/{serviceId}/routes/tags
Adds or replaces the tags of a route in a gateway service. Any existing tag that is not in the request body is removed.
Path parameters
| Parameter | Description | Type | Required/ Optional |
|---|---|---|---|
| serviceId | The unique identifier of the gateway service that contains the route to add/replace tags. | string | Required. |
Query parameters
| Parameter | Description | Type | Required/ Optional |
|---|---|---|---|
| method | The HTTP method of the route to add/replace tags. | string | Required. |
| path | The path of the route to add/replace tags. | string | Required. |
Request body
The request body should be an array of tag objects.
| Parameter | Description | Type | Required/ Optional |
|---|---|---|---|
| key | The tag key. | string | Required. |
| value | The tag value. | string | Required. |
Response
- Returns 200 OK, indicating that the tags have been set on the route.
- Returns 403 Forbidden if you do not have permission to update the service.
- Returns 404 Not Found if no service exists with the given
serviceId, or no route exists with the givenmethodandpath.
Examples
Add a tag to a route
Request
curl -X 'PUT' \
'https://<YOUR-SERVER-URL>/api/gateway/config/services/test-service/routes/tags?method=POST&path=%2Fcreate' \
-H 'accept: */*' \
-H 'X-Authorization: <TOKEN>' \
-H 'Content-Type: application/json' \
-d '[
{
"key": "docs",
"value": "test"
}
]'
Response
Returns 200 OK, indicating that the tag has been added to the route.
Replace a tag in a route
Request
curl -X 'PUT' \
'https://<YOUR-SERVER-URL>/api/gateway/config/services/test-service/routes/tags?method=POST&path=%2Fcreate' \
-H 'accept: */*' \
-H 'X-Authorization: <TOKEN>' \
-H 'Content-Type: application/json' \
-d '[
{
"key": "blogs",
"value": "test"
}
]'
Response
Returns 200 OK, indicating that the tag has been replaced in the route.