Searching
Resource collections are searched by using the search query parameter. Searching allows you to filter results by matching the provided value against supported fields.
Search Query Parameter
The search parameter accepts a single value and returns records that partially or fully match that value across searchable fields.
?search=valueSearchable Fields
- Not all fields are searchable
- Refer to each endpoint’s parameter description to see which fields support searching
- Unsupported fields will be ignored or may return a validation error
Example: Search Users by Name
To search for users whose details match the value john:
curl -H 'Authorization: <Access-Token>' \
--request GET 'https://api.timeero.app/api/public/users?search=john'
This request may match against fields such as first name, last name, or email, depending on endpoint configuration.
Combining Search with Pagination and Sorting
Search can be combined with pagination and sorting to refine results.
curl -H 'Authorization: <Access-Token>' \
--request GET 'https://api.timeero.app/api/public/users?search=john&page=1&page_size=10&sort=firstName'
Filter by Date Range
You can filter collections by a date range using the date_range query parameter. This is commonly used for time-based resources such as timesheets, schedules, and activity logs.
Date Range Query Parameter.
The date_range parameter accepts two dates separated by a comma (,).
?date_range=YYYY-MM-DD,YYYY-MM-DD
Date format must be Y-m-d. The range is inclusive of both start and end dates
Combining Date Range with Search and Sorting
curl -H 'Authorization: <Access-Token>' \
--request GET 'https://api.timeero.app/api/public/timesheets?search=john&date_range=2022-01-01,2022-02-28&sort=-created_at'
Usage Guidelines
- Always verify searchable fields in the endpoint documentation
- Use date filtering to limit large datasets
- Combine search, sorting, and pagination for optimal performance
- Avoid broad searches on large collections without pagination
Updated 6 days ago