How to Query Results

Summary

You can query the results of a GET request in our API with specific parameters. Many of those listed below can meet use cases where only specific data is required. For larger data sets, read the Cursor section to learn how to obtain a consistent sort order in the data response.

ParameterPurposeExample
?whereTo pass a string containing a JavaScript expression/locations?where={"account":"5f327*****f5cd5"\}
max_resultsThe limit is 500 results. Only 25 results are returned if this parameter is not set.?max_results=500
sortSpecify the order in which the query returns the results. Add - for descending e.g. sort=-_created and without for ascending sort=_created?sort=-_created
cursorView the Cursor section. ?cursor=new
$gteThe value of the specified field is greater than or equal.e.g. "$gte": "YYYY-MM-DDTHH:mm:ss.SSSSSSZ"
$lteThe value of the specified field is lesser than or equal.e.g. "$lte": "YYYY-MM-DDTHH:mm:ss.SSSSSSZ"
$inThe value of the specified field is equal to any value in the specified arraye.g. "$in":[1, 2]
$neResults are returned where the specified value does no exist.e.g. "$ne":"5be9*********46d4"
$existsA boolean to filter out results where a value exists or not.e.g. "$exists": true,

Cursor

When sending a query that returns paged results but no sorting is requested, Deliverect returns the results with a warning:

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

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

While you could use ?sort=-\_created to return a consistent order, we recommend that you query using &cursor=new as this has more reliability.

Here is an example of a Get Locations query:

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

This provides within the first page of results a "cursor" ID (view the 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 using 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 would be sent using:

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