-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat: enhance admin api filter #12291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: enhance admin api filter #12291
Conversation
Co-authored-by: Traky Deng <[email protected]>
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' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one question: can we adjust to use the format a[b]=c&a[d]=e
? It seems more common. https://www.npmjs.com/package/qs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
ngx.log(ngx.ERR, require("cjson").encode(ngx.decode_args("filter%5Bservice_id%5D=a&filter%5Bservice_id%5D=b&b=c&c=c")))
[lua] test.lua:1: {"filter[service_id]":["a","b"],"b":"c","c":"c"}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Traky Deng <[email protected]>
Description
Added filter enhancements to the Admin API, allowing routes and stream routes to be filtered by
service_id
andupstream_id
.This is mainly used to enhance the APISIX dashboard.
Checklist