-
Notifications
You must be signed in to change notification settings - Fork 0
Home
John McArthur edited this page Mar 22, 2023
·
9 revisions
Welcome to the REST-Parser wiki!
Services that support $filter SHOULD support the following minimal set of operations.
Operator | Description | Example |
---|---|---|
Comparison Operators | ||
eq | Equal | city[eq]=Redmond |
ne | Not equal | city[ne]=London |
gt | Greater than | price[gt]=20 |
ge | Greater than or equal | price[ge]=10 |
lt | Less than | price[lt]=20 |
le | Less than or equal | price[le]=100 |
contains | contains the value | surname[contains]=Mac |
GET /items?surname[eq]smith
GET /items?$sort_by=surname
GET /items?$sort_by[asc]=surname
GET /items?$sort_by[desc]=surname
GET /items?$sort_by[asc]=surname&sort_by[desc]=firstname
GET /items?$page=2&$pageSize=10
{
"data" : [
{ data item 1 with all relevant fields },
{ data item 2 },
...
{ data item 10 }
],
"Pagination": {
"PageNumber": 1,
"PageSize": 10,
"PageCount": 1,
"TotalCount": 9
}
}
GET /items?surname[contains]=Smi&hometown[eq]=Edinburgh&$sort_by[asc]=surname&sort_by[desc]=firstname&$page=1&$pageSize=10
"Pagination": {
"Previous": "http://api.example.com/items/$page=1&$pageSize=10",
"Next": "http://api.example.com/items/$page=3&$pageSize=10",
"PageNumber": 1,
"PageSize": 10,
"PageCount": 1,
"TotalCount": 9
}
Developers who want to know the full number of records across all pages, MAY include the query parameter $count=true to tell the server to include the count of items in the response.
GET /items?$count=true
{
"data" : [
{ data item 1 with all relevant fields },
{ data item 2 },
...
{ data item 45 }
],
"Pagination": {
"TotalCount": 45
}
}