Filtering & pagination with CereTax APIs
Filtering
Filtering can be done on any of the CereTax APIs that support the $filter query parameter. This parameter allows you to search for records that match specific criteria. For example, if you want to search for all of the sale transactions for a specific customer, you could submit the following request:
GET /sale?$filter=customerAccount eq ABC Incorporated
CereTax supports the following comparison operators for filtering:
Comparison operator | Symbol | Example |
---|---|---|
Equals | eq | invoiceDate eq 01-01-2023 |
Not equal | ne | invoiceDate ne 01-01-2023 |
Greater than | gt | invoiceDate gt 01-01-2023 |
Greater than or equal to | ge | invoiceDate ge 01-01-2023 |
Less than | lt | invoiceDate lt 01-01-2023 |
Less than or equal to | le | invoiceDate le 01-01-2023 |
Additionally, if you need to retrieve records that match a combination of filter criteria, you can use logical operators, like and & or, to combine multiple statements.
Logical operator | Symbol | Example |
---|---|---|
And | and | invoiceDate eq 01-01-2023 and customerAccount = ABC |
Or | or | invoiceDate eq 01-01-2023 or customerAccount = ABC |
Pagination
Pagination is supported on any of the CereTax APIs with the perPage
and page
parameters. These parameters allow you to handle pagination within your own applications and to only retrieve records that need to be displayed.
- The
perPage
parameter controls the specific number of records that should be returned on each page of results. If you pass a value of 20, then the results in the response will be limited to 20 records per page. - The
page
parameter controls the specific page of results you want to retrieve. The number of pages depends on the total number of records matching your request and theperPage
value in your request. - For example, if 100 records match your request and you submit a
perPage
value of 20, there will be 5 pages of results. Submitting a page value of 2 would retrieve records 21 through 40.
The total number of results in your request, regardless of page size, will be returned in the totalResults
parameter.
Updated about 1 year ago