API7 Docs

Replace a single nested field of a service

PATCH /apisix/admin/services/{id}/{sub_path}

PATCH /apisix/admin/services/{id}/{sub_path}

Interactive request editor loads with JavaScript.

Authorization

X-API-KEY<token>

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

id*|

Resource identifier.

sub_path*string

Slash-separated nested key path within the resource document.

Query Parameters

ttl?integer

Time-to-live in seconds. The resource is automatically removed when it expires.

Range1 <= value

Request Body

application/json

body*unknown

Response Body

application/json

application/json

application/json

curl -X PATCH "http://127.0.0.1:9180/apisix/admin/services/r1/enable_websocket?ttl=3600" \  -H "Content-Type: application/json" \  -d 'true'

Sub-field replaced.

Complete operation details and schema variants

PATCH /apisix/admin/services/{id}/{sub_path}

Replace a single nested field of a service

Replaces the value at sub_path within the service 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/services/{id}/{sub_path}'