OData Query Parameters
Verso API supports OData query parameters for filtering, sorting, and paginating results on all GET endpoints. This guide covers the available query options with practical examples.
Route Pattern
All examples use the Partner route pattern: /partners/5/tenants/10/{resource}. Replace with your actual partnerId and tenantId.
Query Parameters Overview
| Parameter | Description | Example |
|---|---|---|
filter | Filter results by conditions | filter=status eq 'Active' |
orderBy | Sort results | orderBy=created desc |
select | Choose specific fields | select=id,name,email |
top | Limit number of results | top=10 |
skip | Skip first N results | skip=20 |
Filtering with filter
Comparison Operators
| Operator | Description | Example |
|---|---|---|
eq | Equal | status eq 'Active' |
ne | Not equal | status ne 'Inactive' |
gt | Greater than | salary gt 50000 |
ge | Greater than or equal | age ge 18 |
lt | Less than | hours lt 40 |
le | Less than or equal | count le 100 |
String Functions
| Function | Description | Example |
|---|---|---|
contains | Contains substring | contains(name, 'John') |
startswith | Starts with | startswith(email, 'admin') |
endswith | Ends with | endswith(email, '@company.com') |
Logical Operators
| Operator | Description | Example |
|---|---|---|
and | Logical AND | status eq 'Active' and age gt 18 |
or | Logical OR | role eq 'Admin' or role eq 'Manager' |
not | Logical NOT | not contains(name, 'Test') |
Examples
Code
Code
Code
When using filter in URLs, remember to URL-encode special characters like spaces. Most HTTP clients handle this automatically.
Sorting with orderBy
Sort results by one or more fields in ascending (asc) or descending (desc) order.
Single Field
Code
Code
Multiple Fields
Code
Field Selection with select
Return only specific fields to reduce response size.
Code
Response:
Code
Using select can significantly improve performance by reducing payload size, especially for large datasets.
Pagination with top and skip
Limit Results
Code
Pagination Pattern
Code
Code
Code
Combined Queries
Combine multiple parameters for powerful queries:
Code
This query:
- Filters for active employees
- Sorts by last name alphabetically
- Returns only id, firstName, and lastName
- Limits to 20 results
- Starts from the first result
Endpoint-Specific Examples
Query Users
Code
Query Payrun Jobs
Code
Job Status Values
Payrun jobs can return to Draft after a successful asynchronous calculation. Require a non-null
jobEnd (or terminal Forecast/Complete) before reading results; Draft alone can still mean
queued or running. Abort and Cancel are failures.
Query Payroll Results
Code
Query Payroll Result Sets (with Pagination)
For detailed wage type breakdowns, use /payrollresults/sets. The payrunJobId query parameter is required to scope results to a specific payrun job:
Code
Code
Code
Dedicated Query Parameters
Some endpoints support dedicated query parameters as a shorthand for common filters. For example, ?payrunJobId=8 is equivalent to ?filter=payrunJobId eq 8. When both are provided, they are combined with and.
Large Batches
For payrun jobs with 100+ employees, always use pagination (top and skip parameters) to avoid timeouts. Recommended page size: 50 results.
Best Practices
- Always paginate large datasets - Use
topandskipfor collections - Select only needed fields - Use
selectto reduce payload size - Index-friendly filters - Filter on indexed fields when possible
- Combine filters efficiently - Use
andto narrow results early
Next Steps
- Error Handling - Handle query errors
- API Reference - Explore all endpoints
- Quickstart - Complete workflow example