End user is usually expected to provide optional filtering conditions in the request by one or more of the allowed methods (which should be explicitly stated in the API documentation). For example, if filtering is handled via POST method using JSON it can be something similar to:
{
"filter": {
"id": {"in": [2, 5, 9]},
"title": {"like": "cheese"}
}
}
The above conditions are:
id must be either 2, 5, or 9 ANDtitle must contain the word cheese.The same conditions sent as a part of GET query are:
?filter[id][in][]=2&filter[id][in][]=5&filter[id][in][]=9&filter[title][like]=cheese
You can change the default filter key word by setting yii\data\DataFilter::$filterAttributeName.
The default list of allowed filter control keywords is as the following:
| filter control | translates to |
|---|---|
and | AND |
or | OR |
not | NOT |
lt | < |
gt | > |
lte | <= |
gte | >= |
eq | = |
neq | != |
in | IN |
nin | NOT IN |
like | LIKE |
Vind het adres: zoek in extern nummer
https://acceptance-api.logiaction.nl/site/v2/common-address?filter[external_number][like]=123
Vind het StockId mbv item_id
https://acceptance-api.logiaction.nl/site/v2/stock?filter[item_id][eq]=10010