Skip to content

Filter, sort and page

Narrow a list of records down with filters, search, sorting, paging and a field list.

Everything on this page is a query parameter on GET /{Collection}. Filters and search also work on GET /{Collection}/count.

Filter by a field#

Use a field name as the parameter. A bare value means "equals". For anything else, put an operator and a colon before the value.

ParameterMatches records where
?status=newstatus equals new
?status=ne:newstatus is not new
?total=gt:50total is greater than 50
?total=gte:50total is 50 or more
?total=lt:200total is less than 200
?total=lte:200total is 200 or less
?total=between:50,200total is between 50 and 200
?status=in:new,paidstatus is one of the listed values
?customer=like:levicustomer contains levi

Combine filters by adding more parameters. A record has to match all of them.

curl "https://apipublic.yeshbe.com/api/v1/Order?status=in:new,paid&total=gte:50" \ -H "Authorization: Bearer $YESHBE_APP_KEY"

search looks for a term across the record.

curl "https://apipublic.yeshbe.com/api/v1/Order?search=levi" \ -H "Authorization: Bearer $YESHBE_APP_KEY"

Sort#

sort takes a field name. Put - in front for descending order.

curl "https://apipublic.yeshbe.com/api/v1/Order?sort=-created_date" \ -H "Authorization: Bearer $YESHBE_APP_KEY"

Page#

page starts at 1. limit is the number of records per page, up to 200.

curl "https://apipublic.yeshbe.com/api/v1/Order?page=2&limit=50" \ -H "Authorization: Bearer $YESHBE_APP_KEY"

The response carries the paging state alongside the items.

JSON
{"success":true,"data":{"items":[],"page":2,"limit":50,"total":340,"pages":7}}

Choose the fields to return#

fields is a comma-separated list. Only those fields come back.

curl "https://apipublic.yeshbe.com/api/v1/Order?fields=customer,total" \ -H "Authorization: Bearer $YESHBE_APP_KEY"

All parameters#

ParameterExampleWhat it does
A field name?status=newFilters by that field
search?search=leviFree-text search
sort?sort=-created_dateSorts by a field, - for descending
page?page=2The page number, starting at 1
limit?limit=50Records per page, up to 200
fields?fields=customer,totalReturns only the listed fields