API7 Docs

Update a stream route in a service on a gateway group

PUT /apisix/admin/stream_routes/{stream_route_id}

PUT /apisix/admin/stream_routes/{stream_route_id}

Interactive request editor loads with JavaScript.

Authorization

X-API-KEY<token>

In: header

Path Parameters

stream_route_id*string

The unique identifier of the published stream route.

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

The stream route with the service ID.

Response Body

application/json

application/json

curl -X PUT "$API_BASE_URL/apisix/admin/stream_routes/bd58fce2-b6cc-4d2d-a53c-6ce11b19c101?gateway_group_id=86fb9981-d9d2-4555-9df8-91ae92129335" \  -H "Content-Type: application/json" \  -d '{    "service_id": "b32e678e-7f6b-4a50-b113-550621ed4c01"  }'

Successfully retrieved or modified the stream route.

{
  "value": {
    "name": "us-west-rsc",
    "labels": {
      "version": "v2",
      "env": "prod"
    },
    "desc": "Object description.",
    "remote_addr": "127.0.0.1",
    "server_addr": "mysql",
    "server_port": 3306,
    "plugins": {
      "ip-restriction": {
        "whitelist": [
          "192.168.0.1/24"
        ],
        "message": "Access denied"
      }
    },
    "id": "bd58fce2-b6cc-4d2d-a53c-6ce11b19c101",
    "service_id": "b32e678e-7f6b-4a50-b113-550621ed4c01",
    "gateway_group_id": "bc1b95c9-b348-4832-acc3-e257d2342df1",
    "gateway_group_name": "us-west-rsc",
    "created_at": 1742288232,
    "updated_at": 1742288235
  }
}
Complete operation details and schema variants

PUT /apisix/admin/stream_routes/{stream_route_id}

Update a stream route in a service on a gateway group

Fully update a stream route in a service through an APISIX Admin API compatible endpoint under /apisix/admin/. This replaces the existing stream-route configuration. Required IAM Permission: Action gateway:UpdatePublishedService, Resource arn:api7:gateway:gatewaygroup/%s/service/%s

Parameters

  • stream_route_id (path, string, required): The unique identifier of the published stream route.
  • 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

  • allOf variant 1
  • allOf variant 1
  • name (string, optional): The object name.
  • labels (object, optional): Key-value pairs of labels.
  • desc (string, optional): The object description.
  • remote_addr (string, optional): Client address filter. If the client request does not originate from remote_addr, the request will not be forwarded to the stream server.
  • anyOf variant 1: IPv4
  • anyOf variant 2: IPv4/CIDR
  • anyOf variant 3: IPv6
  • anyOf variant 4: IPv6/CIDR
  • server_addr (string, optional): Stream server address.
  • anyOf variant 1: IPAddress
  • anyOf variant 1: IPv4
  • anyOf variant 2: IPv4/CIDR
  • anyOf variant 3: IPv6
  • anyOf variant 4: IPv6/CIDR
  • anyOf variant 2: Domain
  • server_port (integer, optional): Stream server port.
  • allOf variant 2
  • plugins (object, optional): Key-value pairs of plugins and their configurations on the object.
  • allOf variant 2
  • service_id (string, required): The service ID.

Responses

  • 200: Successfully retrieved or modified the stream route.
  • allOf variant 1
  • value (object, optional): The specific resource.
  • allOf variant 2
  • value (object, optional): The stream route 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.remote_addr (string, optional): Client address filter. If the client request does not originate from remote_addr, the request will not be forwarded to the stream server.
  • anyOf variant 1: IPv4
  • anyOf variant 2: IPv4/CIDR
  • anyOf variant 3: IPv6
  • anyOf variant 4: IPv6/CIDR
  • value.server_addr (string, optional): Stream server address.
  • anyOf variant 1: IPAddress
  • anyOf variant 1: IPv4
  • anyOf variant 2: IPv4/CIDR
  • anyOf variant 3: IPv6
  • anyOf variant 4: IPv6/CIDR
  • anyOf variant 2: Domain
  • value.server_port (integer, optional): Stream server port.
  • allOf variant 2
  • value.plugins (object, optional): Key-value pairs of plugins and their configurations on the object.
  • allOf variant 2
  • value.id (string, optional): The object ID.
  • value.service_id (string, optional): The service ID.
  • value.gateway_group_id (string, optional): The gateway group ID.
  • value.gateway_group_name (string, optional): The object name.
  • 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 PUT '$API_BASE_URL/apisix/admin/stream_routes/{stream_route_id}'