Searches are available on the parent entity endpoints, that is:
Note: that the following 2 forms of the search URLs are considered equivalent by the API
Complex searches can be performed by a url-encoded searchParams JSON object as a query param. You can find out more about complex searches here:
The basic search, that is a search without any query params, returns the 25 most recently created records in descending order by created date.
How to paginate results
You can use the count and the offset query parameters to paginate the search results
Specifies the number of records to return in the search results. If its not specified, defaults to 25.
Max allowed value is 100 so, if a number greater than 100 is specified, it will be ignored and only
100 records will be returned
|offset||Specifies the number of records to skip from the beginning. If not specified, defaults to 0|
All API search responses return the following 3 params:
|totalCount||The total count of the records in the database for the requested search criteria|
Same as specified in the query parameters, except when the user has provided
an invalid value. In which case the API will override it with the default value
|offset||Same as specified in the query parameters. If not specified, defaults to 0|
So, for example, to retrieve the most recently modified records, with a page size of 50, you will need to do this:
A response containing the following 3 params will be returned
This indicates that there are 363 records present in the database matching the given search criteria. The count of the results in the response is 50 and because the offset is 0, records from 1-50 have been returned.
To get the records from 51-100, make the following query:
which should return:
The count of the results in the response is 50 and because the offset is 50 this time, records from 51-100 have been returned.
Sorting the search results
The sorting of the search results is controlled by the following query params:
|sortKey||The field to sort the results by. Allowed values are creationDate, lastModifiedDate. If not passed, will default to creationDate|
|sortOrder||Whether to sort ascending or descending. Allowed values are ASC and DESC. Default is DESC|
For example, below query demonstrates how to get the 25 most recently modified records in ascending order
Searching with dates
The searches which take dates as searchParams, also support searching across a date range.
To search between 2 dates
For example, below search demonstrates how to get the contacts created between 2 dates, say 1st April and 30th April 2017:
The search query will look as follows:
Note: The forward slash '/' , indicates a range search. You can also use 2 dots '..' or the preposition 'to', to indicate a range search.
To search after a certain date
The below search demonstrates how to get the contacts created on and after 30 April 2017:
To search on a given date
The below search demonstrates how to get the contacts created on 1 April 2017:
To search before a certain date
The below search demonstrates how to get the contacts created on and before 1 April 2017:
To search using an exact time stamp
The below search demonstrates how to get the contacts created exactly on 1 April 2017, 5 AM:
Note: Time will be considered to be in AEST.
To search between two time stamps
The below search demonstrates how to get the contacts created in the last 2 hours:
"createdOn":"2017-04-01 12:00:00/2017-04-01 14:00:00"