Query String Structure
The query string format follows these conventions:- Parameters are separated by
& - Array values are represented by multiple parameters with the same name
- The default delimiter for field operators is
|| - The default delimiter for array values is
,
Available Parameters
fields (select)
Select specific fields to include in the response.fields=field1,field2,field3
If no fields are specified, all fields are returned by default (unless restricted by the backend).
filter
Apply AND filter conditions. Format:filter=field||operator||value
or
Apply OR filter conditions. Format:or=field||operator||value
OR Conditions
Combining AND and OR
Mixed Conditions
(status = 'active') AND (role = 'admin' OR role = 'moderator')
Filter Operators
Equality Operators
| Operator | Description | Example | ||||
|---|---|---|---|---|---|---|
$eq | Equals | `filter=id | $eq | 1` | ||
$ne | Not equals | `filter=status | $ne | deleted` | ||
$eqL | Equals (case-insensitive) | `filter=name | $eqL | john` | ||
$neL | Not equals (case-insensitive) | `filter=role | $neL | admin` |
Comparison Operators
| Operator | Description | Example | ||||
|---|---|---|---|---|---|---|
$gt | Greater than | `filter=age | $gt | 18` | ||
$lt | Lower than | `filter=age | $lt | 65` | ||
$gte | Greater than or equal | `filter=price | $gte | 100` | ||
$lte | Lower than or equal | `filter=price | $lte | 1000` |
String Operators
| Operator | Description | Example | ||||
|---|---|---|---|---|---|---|
$starts | Starts with | `filter=name | $starts | John` | ||
$ends | Ends with | `filter=email | $ends | @gmail.com` | ||
$cont | Contains | `filter=description | $cont | nestjs` | ||
$excl | Excludes | `filter=tags | $excl | deprecated` | ||
$startsL | Starts with (case-insensitive) | `filter=name | $startsL | john` | ||
$endsL | Ends with (case-insensitive) | `filter=email | $endsL | @GMAIL.COM` | ||
$contL | Contains (case-insensitive) | `filter=description | $contL | NestJS` | ||
$exclL | Excludes (case-insensitive) | `filter=tags | $exclL | DEPRECATED` |
Array Operators
| Operator | Description | Example | ||||
|---|---|---|---|---|---|---|
$in | In array | `filter=status | $in | active,pending` | ||
$notin | Not in array | `filter=role | $notin | guest,banned` | ||
$inL | In array (case-insensitive) | `filter=role | $inL | Admin,Moderator` | ||
$notinL | Not in array (case-insensitive) | `filter=status | $notinL | DELETED,BANNED` |
Null Operators
| Operator | Description | Example | ||
|---|---|---|---|---|
$isnull | Is null | `filter=deletedAt | $isnull` | |
$notnull | Not null | `filter=email | $notnull` |
Range Operator
| Operator | Description | Example | ||||
|---|---|---|---|---|---|---|
$between | Between two values | `filter=age | $between | 18,65` |
Advanced Search (s)
Thes (search) parameter accepts complex nested JSON conditions.
Format: s={"field":"value"} (URL encoded)
When the
s parameter is present, filter and or parameters are ignored. The search parameter takes precedence.Search Structure Examples
Simple Field Matching
Field with Operators
OR Conditions
AND Conditions
Complex Nested Logic
Join Relations
Load related entities with their data. Format:join=relation or join=relation||field1,field2
Sorting
Sort results by one or more fields. Format:sort=field,ORDER
Orders: ASC (ascending) or DESC (descending)
Pagination
Limit
Limit the number of results returned. Format:limit=number
Set Limit
per_page=20
Offset
Skip a specific number of records. Format:offset=number
Set Offset
Page
Use page-based pagination. Format:page=number
Page-based Pagination
When using
page, the offset is calculated as (page - 1) * limit. You should always specify a limit when using page.Cache Control
Control server-side caching behavior. Format:cache=0 or cache=1
Reset Cache
cache=0 forces a fresh database query, bypassing any cached results.
Soft Deletes
Include soft-deleted records in the results. Format:include_deleted=number
This only works if your entity has soft delete enabled. See the Soft Delete guide for more information.
Complete Examples
Example 1: Basic Filtering and Pagination
- Select fields: id, name, email
- Filter: isActive = true
- Sort by name ascending
- Return 20 items from page 1
Example 2: Complex Filtering with Relations
- Select post fields: id, title, publishedAt
- Join author relation (only id and name)
- Join all comments
- Filter: status = ‘published’ AND publishedAt >= ‘2024-01-01’
- Sort by publishedAt descending
- Limit to 10 results
Example 3: Search with OR Conditions
- Select fields: id, name, email
- Filter: status = ‘active’ AND (role = ‘admin’ OR role = ‘moderator’)
- Sort by createdAt descending
Example 4: Advanced Search Query
- Search: (name contains ‘laptop’ OR description contains ‘laptop’) AND price between 500-2000 AND inStock = true
- Sort by price ascending
Example 5: Nested Relations
- Join posts relation
- Join comments relation from posts
- Join author relation from comments (only id and name)
- Filter posts where status = ‘published’
- Sort by post publishedAt descending
URL Encoding
When building URLs manually, remember to encode special characters:| Character | Encoded |
|---|---|
|| | %7C%7C |
, | %2C |
$ | %24 |
{ | %7B |
} | %7D |
" | %22 |
: | %3A |
[ | %5B |
] | %5D |
Custom Parameter Names
You can configure custom parameter names on both frontend and backend:Frontend Configuration
Backend Configuration
Custom Parameter Names
Debugging Query Strings
Browser Console
Network Tab
Inspect the actual request in your browser’s Network tab to see the final URL with all query parameters.Best Practices
Use RequestQueryBuilder
Always use RequestQueryBuilder instead of manually constructing query strings to avoid encoding issues and syntax errors.
Select Only Needed Fields
Always specify the fields you need rather than fetching all fields, especially for large entities.
Limit Joined Relations
When joining relations, specify which fields to include to reduce payload size.
Use Pagination
Always implement pagination for list endpoints to prevent performance issues with large datasets.
Next Steps
RequestQueryBuilder
Learn how to use the RequestQueryBuilder class
Controllers
Set up CRUD controllers to handle these queries