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.
| Parameter | Matches records where |
|---|---|
?status=new | status equals new |
?status=ne:new | status is not new |
?total=gt:50 | total is greater than 50 |
?total=gte:50 | total is 50 or more |
?total=lt:200 | total is less than 200 |
?total=lte:200 | total is 200 or less |
?total=between:50,200 | total is between 50 and 200 |
?status=in:new,paid | status is one of the listed values |
?customer=like:levi | customer 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"const data = awaitapi("/Order?status=in:new,paid&total=gte:50");data = api("/Order?status=in:new,paid&total=gte:50")var res = await client.GetStringAsync("Order?status=in:new,paid&total=gte:50");Search#
search looks for a term across the record.
curl "https://apipublic.yeshbe.com/api/v1/Order?search=levi" \ -H "Authorization: Bearer $YESHBE_APP_KEY"const data = awaitapi("/Order?search=levi");data = api("/Order?search=levi")var res = await client.GetStringAsync("Order?search=levi");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"const data = awaitapi("/Order?sort=-created_date");data = api("/Order?sort=-created_date")var res = await client.GetStringAsync("Order?sort=-created_date");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"const data = awaitapi("/Order?page=2&limit=50");data = api("/Order?page=2&limit=50")var res = await client.GetStringAsync("Order?page=2&limit=50");The response carries the paging state alongside the items.
{"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"const data = awaitapi("/Order?fields=customer,total");data = api("/Order?fields=customer,total")var res = await client.GetStringAsync("Order?fields=customer,total");All parameters#
| Parameter | Example | What it does |
|---|---|---|
| A field name | ?status=new | Filters by that field |
search | ?search=levi | Free-text search |
sort | ?sort=-created_date | Sorts by a field, - for descending |
page | ?page=2 | The page number, starting at 1 |
limit | ?limit=50 | Records per page, up to 200 |
fields | ?fields=customer,total | Returns only the listed fields |