How to query results

Summary

With each GET request in our API, the results can be queried with certain parameters. Many of those listed below can meet certain use cases where only specific data is required. For larger data sets, the section below on using the cursor method would be essential to obtain a consistent sort order in data response.

parameterpurposeexample
&page=Where pagination applies, this allows a specific page to be queried&page=2
?max_results=The limit is of 500 results, please note, without this parameter set a default of 25 results will be returned?max_results=500
?sort=?sort=-\_created
?where=/locations?where={"account":"5f327*f5cd5"}
?cursor=(see section below)?cursor=new

Cursor

When sending a query which returns paged results, but no sorting requested, Deliverect will return the results along with a warning;

"warning": "For more correct paged results, please use sort, cursor or preference"

This is because when paging through results, with each page request, our database won't always return the data in the same order.

To ensure the results are returned with a consistent order, using e.g. ?sort=-\_created would be one method, we do however recommend that for full reliability, that you query using &cursor=new

See example below of a Get Locations query;

https://api.deliverect.com/locations?where={"account":"61*********34"}&cursor=new&max_results=500

This works to provide within the first page of results a "cursor" ID (see example below)

All subsequent calls should then pass this ID as &cursor={CURSOR_STRING_FROM_META} to ensure you are retrieving data from our database from the same cursor point.

},  
    "\_meta": {
    "page": 1,
    "max_results": 500,
    "total": 584,
    "cursor": "e8c9b36f***ccfbeff08fe"
}

To page through to the next set of results, subsequent requests will be sent as;

https://api.deliverect.com/locations?where={"account":"61****\*****34"}&cursor=e8c9b36f***ccfbeff08fe&max_results=500&page=2