How can we use a date range with an API endpoint to filter the results returned?
Resolution:
You can filter dates using the $filter parameter. The $filter parameter specifies inclusion or exclusion criteria for returning matches in search results.
The &take can be used to limit the number of records that are returned. Using this operator will return up to the specified number of rows. These requests will return up to 10 records for the date range.
You can remove or change the value of the &take=10 to return all records or a different number of records for the date range.
Examples:
GET AR Invoices by date.
api/CustomerInvoice?$filter=InvoiceDateFormatted ge 2023-04-01T00:00:00Z and InvoiceDateFormatted lt 2023-04-02T00:00:00Z&take=10
GET Service Tickets by date.
/api/ServiceTicket?$filter=CreationDate ge 2023-04-01T00:00:00Z and CreationDate lt 2023-04-02T00:00:00Z&take=10