The API supports an advanced filtering system using the filter
query parameter, which allows clients to specify complex filtering logic. This feature enables precise and efficient querying of resources based on multiple conditions and nested relationships.Filter Syntax#
Filters are defined using the filter
parameter in the query string. The format supports logical operators (AND
, OR
), nested conditions, and a variety of comparison operators.Basic Filter#
To apply a simple filter:{
"data": [
{
"id": 1,
"name": "Example Name"
}
],
...pagination data
}
Multiple Filters#
Combine filters using logical operators (AND
, OR
) and parentheses for grouping:{
"data": [
{
"id": 1,
"price": 150,
"category": "Electronics"
}
],
...pagination data
}
Nested Filters#
Use dot notation to filter based on related resources:{
"data": [
{
"id": 1,
"name": "Example",
}
],
...pagination data
}
Supported Operators#
The following operators are supported for filtering:Operator | Example Query | Description |
---|
eq | name:eq:Example | Field is equal to the given value |
gt | price:gt:100 | Field is greater than the given value |
lt | price:lt:100 | Field is less than the given value |
gte | price:gte:500 | Field is greater than or equal to the given value |
lte | price:lte:500 | Field is less than or equal to the given value |
like | name:like:john | Field contains the value (case-insensitive) |
contains | name:contains:john | Acts the same as the like operator |
starts_with | email:starts_with:info | Field starts with the given value |
ends_with | email:ends_with:@example.com | Field ends with the given value |
in | status:in:active;pending;suspended | Field matches any of the given values |
not | status:not:eq:active | Negates the filter condition |
| | |
Behavior Notes#
Logical operators (AND
, OR
) are case-insensitive.
Fields used in the filter do not require to be in show
or with
.
If an invalid operator is provided, the API will return a 400 Bad Request
response with details of the error.
Modified at 2025-08-27 07:38:36