bzp2010 commented on code in PR #12291: URL: https://github.com/apache/apisix/pull/12291#discussion_r2139157242
########## docs/en/latest/admin-api.md: ########## @@ -278,6 +278,42 @@ curl 'http://127.0.0.1:9180/apisix/admin/routes?name=test&uri=foo&label=' \ } ``` +### Support reference filtering query + +:::note + +This feature was introduced in APISIX 3.13.0. + +It now supports querying by `service_id` and `upstream_id` on routes and stream routes. Other resources or other fields are not supported. + +::: + +When getting a list of resources, it supports a `filter` for filtering resources by filters. + +It is encoded in the following manner. + +```text +filter=escape_uri(key1=value2&key2=value2) +``` + +The following example filters routes using `service_id`. Applying multiple filters simultaneously will return results that match all filter conditions. + +```shell +curl 'http://127.0.0.1:9180/apisix/admin/routes?filter=service_id%3D1' \ Review Comment: There is no existing API for parsing query strings for such objects in OpenResty, so it may have to use regular expressions to do so. I don't want to do that right now. The existing format can be implemented in any language client, it's nothing more than a URI-encoded string. ```lua ngx.log(ngx.ERR, require("cjson").encode(ngx.decode_args("filter%5Bservice_id%5D=a&filter%5Bservice_id%5D=b&b=c&c=c"))) ``` ```text [lua] test.lua:1: {"filter[service_id]":["a","b"],"b":"c","c":"c"} ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org