API7 Docs

Get Stream Route by ID

GET /apisix/admin/stream_routes/{id}

GET /apisix/admin/stream_routes/{id}

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*string

Unique identifier of the resource. Can be a string (alphanumeric, -, _, .) or a positive integer.

Response Body

application/json

application/json

curl -X GET "http://127.0.0.1:9180/apisix/admin/stream_routes/my-resource-1"

Successful response.

{
  "id": "1",
  "create_time": 1684392990,
  "server_addr": "127.0.0.1",
  "upstream": {
    "hash_on": "vars",
    "pass_host": "pass",
    "nodes": {
      "127.0.0.1:1995": 1
    },
    "type": "roundrobin",
    "scheme": "http"
  },
  "update_time": 1684392990,
  "server_port": 2000
}
Complete operation details and schema variants

GET /apisix/admin/stream_routes/{id}

Get Stream Route by ID

Get stream route by ID.

Parameters

  • id (path, string, required): Unique identifier of the resource. Can be a string (alphanumeric, -, _, .) or a positive integer.

Responses

  • 200: Successful response.
  • items (object, optional): Stream route entry with metadata.
  • items.value (object, optional): Stream route values.
  • items.value.desc (string, optional): Description of the stream route.
  • items.value.upstream_id (object, optional): Upstream ID.
  • anyOf variant 1
  • anyOf variant 2
  • items.value.update_time (integer, optional): Update time of the stream route.
  • items.value.create_time (integer, optional): Creation time of the stream route.
  • items.value.sni (string, optional): The SNI hostname for matching the TLS passthrough routing.
  • items.value.id (object, optional): Unique identifier for the stream route.
  • anyOf variant 1
  • anyOf variant 2
  • items.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
  • items.value.protocol (object, optional): Protocol configuration for the stream route.
  • items.value.protocol.logger (array, optional): An array of logger plugin configurations.
  • items.value.protocol.logger[].conf (object, optional): Logger plugin configuration.
  • items.value.protocol.logger[].filter (array, optional): Logger filter rules.
  • items.value.protocol.logger[].name (string, optional): Name of the logger plugin.
  • items.value.protocol.conf (object, optional): Protocol-specific configuration.
  • items.value.protocol.superior_id (object, optional): ID of a superior protocol configuration.
  • anyOf variant 1
  • anyOf variant 2
  • items.value.protocol.name (string, required): Name of the protocol.
  • items.value.server_addr (string, optional): Server IP address.
  • anyOf variant 1: IPv4
  • anyOf variant 2: IPv4/CIDR
  • anyOf variant 3: IPv6
  • anyOf variant 4: IPv6/CIDR
  • items.value.upstream (object, optional): Upstream configuration for the stream route.
  • items.value.upstream.desc (string, optional): Description of the upstream.
  • items.value.upstream.update_time (integer, optional): Update time of the stream route.
  • items.value.upstream.key (string, optional): The key used with hash_on when type is chash.When hash_on is set to header or cookie, key is required.When hash_on is set to vars or vars_combinations, key is required and supports built-in variables.When hash_on is set to consumer, key is not required as the consumer name will be used as the key automatically.
  • items.value.upstream.retries (integer, optional): The number of retries while passing the request to an upstream.
  • items.value.upstream.retry_timeout (number, optional): Timeout to continue with retries. Setting this to 0 disables the retry timeout.
  • items.value.upstream.pass_host (string, optional): How to set the Host header when proxying to the upstream.
  • items.value.upstream.upstream_host (string, optional): Configure the host when the request is forwarded to the upstream. pass is used to pass the request's host to the upstream without modification. node sets the host to the host of the upstream node. rewrite sets the host to the value of upstream_host.
  • items.value.upstream.type (string, optional): Load balancing algorithm. Support weighted round robin, consistent hashing, exponentially weighted moving average, and least connections algorithms.
  • items.value.upstream.checks (object, optional): Health check configurations.
  • items.value.upstream.checks.active (object, optional): Active health check configuration.
  • items.value.upstream.checks.active.port (integer, optional): By default, the port is the same as the one defined in the upstream target.
  • items.value.upstream.checks.active.healthy (object, optional): Active health check healthy configurations.
  • items.value.upstream.checks.active.healthy.http_statuses (array, optional): A list of HTTP response status codes which are considered healthy.
  • items.value.upstream.checks.active.healthy.interval (integer, optional): Time interval of checking healthy targets in seconds.
  • items.value.upstream.checks.active.healthy.successes (integer, optional): The number of successful probes to define a healthy target.
  • items.value.upstream.checks.active.http_path (string, optional): The HTTP path in HTTP probe requests.
  • items.value.upstream.checks.active.https_verify_certificate (boolean, optional): If true, verify the target's TLS certificate.
  • items.value.upstream.checks.active.unhealthy (object, optional): Active health check unhealthy configurations.
  • items.value.upstream.checks.active.unhealthy.interval (integer, optional): Time interval of checking unhealthy targets in seconds.
  • items.value.upstream.checks.active.unhealthy.tcp_failures (integer, optional): The number of TCP-related failures to define an unhealthy target.
  • items.value.upstream.checks.active.unhealthy.timeouts (integer, optional): The number of probe timeouts to define an unhealthy target.
  • items.value.upstream.checks.active.unhealthy.http_statuses (array, optional): A list of HTTP response status codes which are considered unhealthy.
  • items.value.upstream.checks.active.unhealthy.http_failures (integer, optional): The number of HTTP-related failures to define an unhealthy target.
  • items.value.upstream.checks.active.req_headers (array, optional): The request headers.
  • items.value.upstream.checks.active.timeout (number, optional): Active check timeout in seconds.
  • items.value.upstream.checks.active.type (string, optional): Active check probing type.
  • items.value.upstream.checks.active.host (string, optional): Host header value for health check probes sent to upstream nodes.
  • items.value.upstream.checks.active.concurrency (integer, optional): The number of targets to be checked at the same time during the active check.
  • items.value.upstream.checks.passive (object, optional): Passive health check configurations.
  • items.value.upstream.checks.passive.healthy (object, optional): Passive health check healthy configurations.
  • items.value.upstream.checks.passive.healthy.http_statuses (array, optional): A list of HTTP response status codes which are considered healthy.
  • items.value.upstream.checks.passive.healthy.successes (integer, optional): The number of successful probes to define a healthy target.
  • items.value.upstream.checks.passive.unhealthy (object, optional): Passive health check unhealthy configurations.
  • items.value.upstream.checks.passive.unhealthy.http_statuses (array, optional): A list of HTTP response status codes which are considered unhealthy.
  • items.value.upstream.checks.passive.unhealthy.http_failures (integer, optional): The number of HTTP-related failures to define an unhealthy target.
  • items.value.upstream.checks.passive.unhealthy.tcp_failures (integer, optional): The number of TCP-related failures to define an unhealthy target.
  • items.value.upstream.checks.passive.unhealthy.timeouts (integer, optional): The number of probe timeouts to define an unhealthy target.
  • items.value.upstream.checks.passive.type (string, optional): Passive check probing type.
  • anyOf variant 1: Active Check
  • anyOf variant 2: Passive Check
  • items.value.upstream.hash_on (string, optional): What to hash on when type is chash.
  • items.value.upstream.name (string, optional): Upstream name.
  • items.value.upstream.scheme (object, optional): Protocol for communicating with upstream nodes.
  • items.value.upstream.keepalive_pool (object, optional): Upstream keepalive connection pool.
  • items.value.upstream.keepalive_pool.size (integer, optional): The number of idle keepalive connections per worker to upstream servers.
  • items.value.upstream.keepalive_pool.idle_timeout (number, optional): Time an idle keepalive connection remains open before being closed, in seconds.
  • items.value.upstream.keepalive_pool.requests (integer, optional): The number of requests a single keepalive connection can handle before closing.
  • items.value.upstream.timeout (object, optional): Timeout settings for connecting to, sending, and receiving messages from the upstream, in seconds.
  • items.value.upstream.timeout.connect (number, optional): Connection timeout in seconds.
  • items.value.upstream.timeout.read (number, optional): Receiving timeout in seconds.
  • items.value.upstream.timeout.send (number, optional): Sending timeout in seconds.
  • items.value.upstream.id (object, optional): Upstream ID.
  • anyOf variant 1
  • anyOf variant 2
  • items.value.upstream.labels (object, optional): Key-value pairs to specify attributes.
  • items.value.upstream.discovery_args (object, optional): Service discovery arguments.
  • items.value.upstream.discovery_args.group_name (string, optional): Group name.
  • items.value.upstream.discovery_args.namespace_id (string, optional): Namespace ID.
  • items.value.upstream.tls (object, optional): TLS configurations.
  • items.value.upstream.tls.verify (boolean, optional): If true, verify the server certificate. Currently only Kafka upstream is supported.
  • items.value.upstream.tls.client_key (string, optional): Private key.
  • items.value.upstream.tls.client_cert (string, optional): Client certificate.
  • items.value.upstream.tls.client_cert_id (object, optional): Client certificate ID.
  • anyOf variant 1
  • anyOf variant 2
  • items.value.upstream.create_time (integer, optional): Creation time of the upstream.
  • oneOf variant 1: Use Upstream Nodes
  • items.value.upstream.nodes (object, required): The upstream endpoints.
  • anyOf variant 1: Weight Mapping
  • anyOf variant 2: Node Objects
  • items.value.upstream.nodes[].weight (integer, optional): Weight of a node.
  • items.value.upstream.nodes[].port (integer, optional): Port of a node.
  • items.value.upstream.nodes[].metadata (object, optional): Metadata of a node.
  • items.value.upstream.nodes[].host (string, optional): Upstream host.
  • items.value.upstream.nodes[].priority (integer, optional): Priority of a node. A higher value corresponds to a higher priority.
  • oneOf variant 2: Use Service Registry
  • items.value.upstream.service_name (string, required): Service name in the service registry. Only valid for service discovery.
  • items.value.upstream.discovery_type (string, required): Discovery type.
  • items.value.plugins (object, optional): Key-value pairs of plugins and their configurations on the object.
  • items.value.server_port (integer, optional): Server port.
  • items.key (string, optional): Unique key identifier for this stream route in the data store.
  • items.modifiedIndex (integer, optional): The index number representing the most recent update to the object. It starts with the same value as createdIndex and increases by 1 each time the resource is modified.
  • items.createdIndex (integer, optional): The index number representing when the object was first created. It indicates the creation order of the resource.
  • 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.

cURL

curl -X GET 'http://127.0.0.1:9180/apisix/admin/stream_routes/{id}'