API7 Docs

Patch a service on a gateway group

PATCH /apisix/admin/services/{service_id}

PATCH /apisix/admin/services/{service_id}

Interactive request editor loads with JavaScript.

Authorization

X-API-KEY<token>

In: header

Path Parameters

service_id*string

The unique identifier of the service.

Match^[a-zA-Z0-9-_.]+$
Length1 <= length <= 256

Query Parameters

gateway_group_id*string

Gateway group ID. Optional when using the gateway group admin key to authenticate.

Length1 <= length

Request Body

application/json

JSON Patch payload as defined by RFC 6902. See JSON Patch for more information.

[index: integer]?|

Response Body

application/json

application/json

curl -X PATCH "$API_BASE_URL/apisix/admin/services/bd58fce2-b6cc-4d2d-a53c-6ce11b19c101?gateway_group_id=86fb9981-d9d2-4555-9df8-91ae92129335" \  -H "Content-Type: application/json" \  -d '[    {      "op": "add",      "path": "/name",      "value": "new-name"    }  ]'

Service updated successfully.

{
  "value": {
    "name": "us-west-rsc",
    "labels": {
      "version": "v2",
      "env": "prod"
    },
    "desc": "Object description.",
    "type": "http",
    "id": "bd58fce2-b6cc-4d2d-a53c-6ce11b19c101",
    "last_published": 1742288230,
    "published_gateway_groups_count": 0,
    "created_at": 1742288232,
    "updated_at": 1742288235
  }
}
Complete operation details and schema variants

PATCH /apisix/admin/services/{service_id}

Patch a service on a gateway group

Partially update a service via JSON Patch (RFC 6902) through an APISIX Admin API compatible endpoint under /apisix/admin/. Use this for targeted field changes. Required IAM Permission: Action gateway:UpdatePublishedService, Resource arn:api7:gateway:gatewaygroup/%s/service/%s

Parameters

  • service_id (path, string, required): The unique identifier of the service.
  • gateway_group_id (query, string, required): Gateway group ID. Optional when using the gateway group admin key to authenticate.

Request body

Content type: application/json

  • oneOf variant 1: add/replace
  • [].op (string, required): The operation to be performed.
  • [].path (string, required): Path to the field to be replaced or added. Path should follow the JSON Pointer format.
  • [].value (object, required): Value to be added or replaced.
  • oneOf variant 2: remove
  • [].op (string, required): The operation to be performed.
  • [].path (string, required): Path to the field to be removed. Path should follow the JSON Pointer format.

Responses

  • 200: Service updated successfully.
  • allOf variant 1
  • value (object, optional): The specific resource.
  • allOf variant 2
  • value (object, optional): The service with management fields.
  • allOf variant 1
  • allOf variant 1
  • value.name (string, optional): The object name.
  • value.labels (object, optional): Key-value pairs of labels.
  • value.desc (string, optional): The object description.
  • value.type (string, optional): Type of service. http corresponds to L7 service and stream corresponds to L4 service.
  • allOf variant 2
  • value.id (string, optional): The object ID.
  • value.last_published (integer, optional): The object timestamp.
  • value.published_gateway_groups_count (integer, optional):
  • value.created_at (integer, optional): The object created timestamp.
  • value.updated_at (integer, optional): The object updated timestamp.
  • 400: Bad Request — The request was malformed or contained invalid parameters. Check the error_msg field for details.
  • value (object, optional): The specific resource.
  • error_msg (string, optional): The error message.

cURL

curl -X PATCH '$API_BASE_URL/apisix/admin/services/{service_id}'