Skip to content

Query Parameters for API Pagination #97

@eschwartz

Description

@eschwartz

The prior art in the repo has us:

  • Return a Link header, 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:

  1. Only support API query params that can be queried against an index (no FilterExpressions
  2. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions