Replace a single nested field of a route
PATCH /apisix/admin/routes/{id}/{sub_path}
PATCH /apisix/admin/routes/{id}/{sub_path}Interactive request editor loads with JavaScript.
Admin API key configured in config.yaml under deployment.admin.admin_key. You can also pass the key as a query parameter api_key or cookie x_api_key.
In: header
Path Parameters
Resource identifier.
Slash-separated nested key path within the resource document.
Query Parameters
Time-to-live in seconds. The resource is automatically removed when it expires.
1 <= valueRequest Body
application/json
Response Body
application/json
application/json
application/json
curl -X PATCH "http://127.0.0.1:9180/apisix/admin/routes/r1/status?ttl=3600" \ -H "Content-Type: application/json" \ -d '1'Sub-field replaced.
**Bad Request** — The request body is invalid or missing required fields.
{
"error_msg": "invalid configuration: property \"uri\" is required"
}{
"error_msg": "invalid request body: unexpected character at line 1 column 2"
}**Unauthorized** — The API key is missing, invalid, or lacks permission.
{
"error_msg": "failed to check token",
"description": "missing apikey"
}{
"error_msg": "failed to check token",
"description": "wrong apikey"
}{
"error_msg": "failed to check token",
"description": "invalid method for role viewer"
}**Not Found** — The specified resource does not exist.
{
"error_msg": "Key not found"
}Complete operation details and schema variants
PATCH /apisix/admin/routes/{id}/{sub_path}
Replace a single nested field of a route
Replaces the value at sub_path within the route document with the request body. The body is any valid JSON value, not necessarily an object. The updated complete resource must pass validation.
Parameters
id(path, object, required): Resource identifier.sub_path(path, string, required): Slash-separated nested key path within the resource document.ttl(query, integer, optional): Time-to-live in seconds. The resource is automatically removed when it expires.
Request body
Content type: application/json
Responses
200: Sub-field replaced.400: Bad Request — The request body is invalid or missing required fields.error_msg(string, required): Human-readable error message describing what went wrong.401: Unauthorized — The API key is missing, invalid, or lacks permission.error_msg(string, required): Authentication error message.description(string, optional): Detailed reason for the authentication failure.404: Not Found — The specified resource does not exist.error_msg(string, required): Error message indicating the resource was not found.
cURL
curl -X PATCH 'http://127.0.0.1:9180/apisix/admin/routes/{id}/{sub_path}'