Add additional bindings to filter end devices and gateways #7313
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
We introduced a new filter field in
ListGatewaysRequest
andListEndDevicesRequest
RPCs however this filter only works on grpc endpoint and not on the http endpoint. The filter is an embedded field in the request and looks like this.The HTTP API generator doesn't recognize it as a query parameter therefore not possible to use it in a HTTP request.
https://github.com/TheThingsNetwork/lorawan-stack/blob/v3.32/api/ttn/lorawan/v3/api.swagger.json#L1052-L1089
Changes
Added an additional HTTP binding on the
List
RPC call. This new binding allows a POST request where the filter field can be used in the payload.Testing
Steps
http://localhost:1885/api/v3/gateways
updated_since
filter using a POST method onhttp://localhost:1885/api/v3/gateways/filter
http://localhost:1885/api/v3/applications/{application id}/devices
updated_since
filter using a POST method onhttp://localhost:1885/api/v3/applications/{application id}/devices/filter
Results
http://localhost:1885/api/v3/gateways
updated_since
filter using a POST method onhttp://localhost:1885/api/v3/gateways/filter
http://localhost:1885/api/v3/applications/{application id}/devices
updated_since
filter using a POST method onhttp://localhost:1885/api/v3/applications/{application id}/devices/filter
Regressions
...
Notes for Reviewers
@johanstokking The filter is an embedded repeated field in the request, probably that is why not recognizing the generator as a query parameter. Together with @KrishnaIyer we came up with the idea to use and additional binding on the HTTP endpoint. It is a POST method where the filter field can be used in the payload. It works but the only drawback is it is adding a POST method to a
List
endpoint besides the default GET method. @johanstokking what do you think? Do you know a better solution?Checklist
README.md
for the chosen target branch.CHANGELOG.md
.CONTRIBUTING.md
, there are no fixup commits left.