Best Practices
Querying Data
How to query data with the SKULabs API
The SKULabs API presents MongoDB-like querying capabilities. This allows you to filter and sort data to retrieve only the information you need.
Required Parameters
To query against SKULabs collections, 4 parameters are required. We’ve included them below.
- selector
- sort
- limit
- skip
Example
{
"selector": {
"status": {
"$in": ["shipped"]
}
},
"sort": {
"end_date": -1
},
"skip": 0,
"limit": 10
}
Selector
Use the selector field to help filter queries. Commonly available fields are included below.
Common Fields
- name
- sku
- upc
- start_date
- end_date
- items
- listings
- custom_fields
- barcodes
- listing_sku
- tags
- fulfillment_sku
- variants
- status
- type
- batch_number
- provider
- order_number
- service
- tracking_number
Example
{
"sku": "red-shirt-001"
}
Sort
Use the sort field to help sort returned documents. Commonly available fields are included below.
Common Fields
- name
- sku
- upc
- type
- store_id
- listing_sku
- fulfillment_sku
- order_number
- status
- batch_number
- date
Example
{
"end_date": 1,
}
Limit
Limit represents an integer that is used to limit the number of documents returned. By default, it is 10.
Example
{
"limit": 10
}
Skip
Skip represents an integer that is used to aid in pagination. By default, it is 0.
Example
{
"skip": 0
}