Most of the models that we expose via our API support list queries i.e. fetching a collection of models in a single request. These queries may be filtered via query parameters.
One of the most common filters is the seller
filter which lets you query for objects owned by a particular seller:
GET /api/orders?seller=SELLER_ID
You can find a seller's SELLER_ID by looking at their checkout button HTML code, for example:
<div
class="xola-checkout"
data-seller="63e1509a461784660477325c"
data-experience="63e1645966d5b4198a2460ec"
data-version="2">
</div>
Authorization
Xola will automatically apply authorization filters to any query you perform. The results returned will only contain data that your credentials authorize you to view. So if you try to query for orders that belong to a seller you don't have access to, you will get zero results.
A more interesting query might be to find orders arriving on a particular day for that seller:
GET /api/orders?seller=SELLER_ID&arrival=2019-11-09
Advanced Queries
The above examples show how to perform exact matches. What if you wanted to find orders across a range of arrival dates, say Nov 8 to Nov 10? Here are a few different ways you could accomplish that:
GET /api/orders?items.arrival[in]=2019-11-08,2019-11-09,2019-11-10
GET /api/orders?items.arrival[gte]=2019-11-08&items.arrival[lte]=2019-11-10
GET /api/orders?items.arrival[range]=2019-11-08,2019-11-10
Supported Operators
Apart from the operators demonstrated in the above examples, we support many more. Some operators are limited to certain types of fields.
Operator | Description | Example |
---|---|---|
equals | Matches values that are equal to a specified value. This is the default operator if none is specified. | arrival[equals]=2019-01-01 arrival=2019-01-01 |
notEqual | Matches all values that are not equal to a specified value. | arrival[notEqual]=2019-01-01 |
gt | Matches values that are greater than a specified value. | arrival[gt]=2019-01-01 |
gte | Matches values that are greater than or equal to a specified value. | arrival[gte]=2019-01-01 |
lt | Matches values that are less than a specified value. | arrival[lt]=2019-01-01 |
lte | Matches values that are less than or equal to a specified value. | arrival[lte]=2019-01-01 |
range | Matches values that inclusively fall within two values. | arrival[range]=2019-01-01,2019-01-15 |
in | Matches any of the values specified in an array. | arrival[in]=2019-01-01,2019-01-02,2019-01-03 |
nin | Matches none of the values specified in an array. | arrival[nin]=2019-01-01,2019-01-02,2019-01-03 |
startsWith | Matches string values that start with a specified value (ignores case). | customerName[startsWith]=john |
endsWith | Matches string values that end with a specified value (ignores case). | customerName[startsWith]=doe |
contains | Matches string values that contain a specified sub-string value (ignores case). | customerName[contains]=do |
doesNotContain | Matches string values that do not contain a specified sub-string value. | customerName[doesNotContain]=john |
exists | Matches objects that have a value for the specified field. | customerName[exists]=true |