OData Querying
This framework implements OData V4 query syntax, allowing you to filter, sort, paginate, and shape your API responses using standardized query parameters.
Supported Query Options
| Option | Description | Example |
|---|---|---|
$select | Choose which fields to return | $select=id,name,email |
$filter | Filter results based on conditions | $filter=age gt 18 |
$orderby | Sort results | $orderby=name asc |
$expand | Include related entities | $expand=orders |
$top | Limit number of results | $top=10 |
$skip | Skip a number of results | $skip=20 |
$count | Include total count in response | $count=true |
Quick Examples
Select Specific Fields
GET /users?$select=id,name,email
Returns only the specified fields. Learn more →
Filter Results
GET /users?$filter=age gt 18 and status eq 'active'
Returns users older than 18 with active status. Learn more →
Sort Results
GET /products?$orderby=price desc,name asc
Sorts by price descending, then by name ascending. Learn more →
Include Related Data
GET /orders?$expand=customer,items
Returns orders with customer and items data included. Learn more →
Pagination
GET /products?$top=20&$skip=40&$count=true
Returns 20 products starting from the 41st, with total count. Learn more →
Combining Query Options
Query options can be combined to create powerful queries:
GET /products?$select=id,name,price&$filter=price gt 50 and inStock eq true&$orderby=price asc&$top=10&$expand=category($select=name)
This query:
- Selects only
id,name, andpricefields - Filters products with price > 50 that are in stock
- Sorts by price ascending
- Limits to 10 results
- Includes category name
Detailed Documentation
- $select - Selecting specific fields
- $filter - Filtering with operators and functions
- $orderby - Sorting results
- $expand - Including related entities
- Pagination - Using $top, $skip, and $count