Basic Usage
Filtering
Smake Checkout API — Filtering
You can search within a collection using ?filter[field].
URL Syntax
/resources?filter[field]=value
Not all attributes are searchable. Some attributes are computed attributes and are not physically so that they are not searchable. In this case, an exception is thrown.
Example
Request
GET /orders?filter[state]=delivered HTTP/1.1Response
{
"data": [
{
"id": 1,
"is_test": true,
"external_identifier": null,
"external_reference": "et",
"state": "delivered",
"customer_locale": "de",
"currency": "EUR",
"total": 87.76,
"subtotal": 86.63,
"total_tax": 1.13,
"total_items_price": 82.98,
"shipping_total": 4.78,
"created_at": "2017-09-27T10:10:59+00:00",
"updated_at": "2017-09-27T10:11:03+00:00",
"cancelled_at": null,
"items": [
{
"id": 1,
"quantity": 4,
"total": 82.98,
"price": 20.54,
"total_tax": 0.82,
"tax_rate": 1,
"variant": {
"id": 27,
"total": 186.58,
"price": 174.37,
"tax": 12.21,
"tax_rate": 7,
"attributes": [
{
"name": "color",
"value": "Khaki"
},
{
"name": "size",
"value": "XL"
}
],
"origin": {
"code": "4490824589755"
},
"media_id": 251,
"views": [],
"created_at": "2017-09-27T10:10:38+00:00",
"updated_at": "2017-09-27T10:10:38+00:00"
},
"created_at": "2017-09-27T10:10:59+00:00",
"updated_at": "2017-09-27T10:10:59+00:00",
"cancelled_at": null
}
],
"customer": {
"id": 40,
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"phone": "12345 67890",
"addresses": [
{
"id": 10,
"default": true,
"company": null,
"first_name": "John",
"last_name": "Doe",
"city": "Anytown",
"street1": "123 Main St",
"street2": null,
"zip": "12345",
"email": "[email protected]",
"phone": "12345 67890",
"province_code": "NW",
"country_code": "DE",
"vat_in": null,
"created_at": "2017-09-27T10:10:59+00:00",
},
{
"id": 11,
"default": false,
"company": null,
"first_name": "John",
"last_name": "Doe",
"city": "Anytown",
"street1": "123 Main St",
"street2": null,
"zip": "12345",
"email": "[email protected]",
"phone": "12345 67890",
"province_code": "NW",
"country_code": "DE",
"vat_in": null,
"created_at": "2017-09-27T10:10:59+00:00",
"updated_at": "2017-09-27T10:10:59+00:00"
}
],
"default_address": {
"id": 10,
"default": true,
"company": null,
"first_name": "John",
"last_name": "Doe",
"city": "Anytown",
"street1": "123 Main St",
"street2": null,
"zip": "12345",
"email": "[email protected]",
"phone": "12345 67890",
"province_code": "NW",
"country_code": "DE",
"vat_in": null,
"created_at": "2017-09-27T10:10:59+00:00",
"updated_at": "2017-09-27T10:10:59+00:00"
},
"created_at": "2017-09-27T10:10:59+00:00",
"updated_at": "2017-09-27T10:10:59+00:00"
},
"shipping_address": {
"id": 45,
"default": true,
"company": null,
"first_name": "John",
"last_name": "Doe",
"city": "Anytown",
"street1": "123 Main St",
"street2": null,
"zip": "12345",
"email": "[email protected]",
"phone": "12345 67890",
"province_code": "NW",
"country_code": "DE",
"vat_in": null,
"created_at": "2017-09-27T10:10:59+00:00",
"updated_at": "2017-09-27T10:10:59+00:00"
},
"billing_address": {
"id": 44,
"default": true,
"company": null,
"first_name": "John",
"last_name": "Doe",
"city": "Anytown",
"street1": "123 Main St",
"street2": null,
"zip": "12345",
"email": "[email protected]",
"phone": "12345 67890",
"province_code": "NW",
"country_code": "DE",
"vat_in": null,
"created_at": "2017-09-27T10:10:59+00:00",
"updated_at": "2017-09-27T10:10:59+00:00"
},
"whitelabel_address": null,
"transactions": [
{
"amount": 87.76,
"title": "Invoice"
}
],
"fulfillments": [
{
"id": 1,
"tracking_number": "2229446017085",
"order": 1,
"parcels": [
[
1
]
],
"created_at": "2021-02-24T11:04:46+01:00",
"updated_at": "2021-02-25T11:35:50+01:00"
}
],
"id_tags": [
{
"id": 1,
"order_item_id": 1,
"current_state": "Goods booked in",
"created_at": "2017-09-27T10:10:59+00:00",
"updated_at": "2017-09-27T10:10:59+00:00"
},
{
"id": 2,
"order_item_id": 1,
"current_state": "Released to production stage",
"created_at": "2017-09-27T10:10:59+00:00",
"updated_at": "2017-09-27T10:10:59+00:00"
},
{
"id": 3,
"order_item_id": 1,
"current_state": "Shipped",
"created_at": "2017-09-27T10:10:59+00:00",
"updated_at": "2017-09-27T10:10:59+00:00"
},
{
"id": 4,
"order_item_id": 1,
"current_state": "Scanned on machine (DTG)",
"created_at": "2017-09-27T10:10:59+00:00",
"updated_at": "2017-09-27T10:10:59+00:00"
}
]
}
],
"links": {
"first": "https://api.smake.io/v2/orders?filter%5Bitems.quantity%5D=4&filter%5Bstate%5D=delivered&filter%5Bcustomer.first_name%5D=like%3A%2Aendr%2A&page=1",
"last": null,
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"path": "https://api.smake.io/v2/orders",
"per_page": 25,
"to": 1
}
}