-
Notifications
You must be signed in to change notification settings - Fork 92
Query Parameters for API Pagination #97
Description
The prior art in the repo has us:
- Return a
Linkheader, which includes the URL for the next page of results - The URL includes query parameters for the "next' primary key in DynDB. eg:
GET /leases?principalId=&nextPrincipalId=&nextAccountId=&
That URL will look a little nicer if we can treat Lease IDs as a primary key
GET /leases?principalId=&nextId=
...though we may actually need to migrate to using Lease.ID as a primary key to get that to work (today it's a GSI, for historical reason...).
One current pain point with pagination queries is that if your DB query is using a FilterExpression, DynamoDB will potentially return you some pages of empty results, in between pages of actual results. This is because DynDB grabs a page of data, and then filters out values.
This is not a great experience for end users. I'd like to either:
- Only support API query params that can be queried against an index (no
FilterExpressions - Hide this behavior from end users (eg. continue to paginate server-side until we get the requested number of records)
option 1. would be much simpler, if we're ok with it.
For example, the GET /leases?status= request should be using our GSI on LeaseStatus (currently it's doing a full table scan)