Filtering responses via the 'datesearch' query parameter
In this guide we will cover:
- Using the 'datesearch' Query Parameter
- Relevant Endpoints
- Example
Using the 'datesearch' Query Parameter
When querying the API, the response can return a filtered list of entities based on a date range. This can be done via the application of 3 query parameters: datesearch, start_date and end_date. start_date and end_date define the date window you wish to filter your response by, and the datesearch parameter allows you to specify the datetime value you wish to apply the filter to.
Relevant Endpoints
Below lists relevant information relating to the endpoints where these query parameters can be applied to.
| Endpoint | Values | Comments |
| Actions | whe_ | instead of start_date and end_date, use startdateand enddate. 'whe_' defines when the Action was completed. |
| Appointments | start_date, last_modified, end_date | start_date and end_date define the start/end date for the appointment(s). Last_modified looks at when the appointment was last modified |
| Client | last_modified | |
| Supplier | datecreated, last_modified | |
| ContractHeader | last_modified | |
| Device | last_modified | |
| Tickets | dateoccurred, dateclosed, dateassigned, responsedate, lastactiondate, nextactivitydate, startdate, targetdate, deadlinedate, followupdate, fixbydate, last_update | |
| Invoice | invoice_date, last_modified, duedate, schedulestartdate, scheduleenddate | |
| Item | last_modified | |
| SalesOrder | last_modified | |
| Quotation | last_modified | |
| Site | last_modified | |
| PurchaseOrder | purchase_order_date, last_modified, date_sent, est_delivery_date, due_date | |
| Agent | last_modified | |
| Users | last_modified |
Example
As an example, I may want to make an API call to only return Customer records that have been updated between the start and end of the 20th of December. To achieve this my API call would look something like
.../api/client?datesearch=last_modified&start_date=2024-12-20T00:00:00.000&end_date=2024-12-21T00:00:00.000