API ReferenceRoadmap
API Reference

Filtering, Ordering, & Pagination

Some of the resources in the Xentral API will support filtering, ordering, and pagination. The Xentral API uses a query string for this.


Filters can be seen as an array of statements that are AND-grouped. Each statement takes the thing we want to filter (key), the operation we want to apply (op) and the values for that operation. It is specified per endpoint which filtering operations are possible, and which filtering keys are allowed.

Two filtering criteria would be represented as JSON the following way:

{ "filter": [
  { "key": "companyName", "op": "startsWith", "value": "X" },
  { "key": "keysCount", "op": "between", "from": 1, "to": 10 }
] }

Represented as query string this would look like:


Operators & Values

The most common operators and their values for applying filters in the Xentral API:

equalsstring / numericvalue string OR value numeric
notEqualsstring / numericvalue string OR value numeric
instring / numericvalue string OR value numeric
notInstring / numericvalue string OR value numeric
lesserThannumeric / datetimevalue numeric
lesserThanOrEqualnumeric / datetimevalue numeric
greaterThannumeric / datetimevalue numeric
greaterThanOrEqualnumeric / datetimevalue numeric
startsWithstringvalue string
endsWithstringvalue string
betweennumeric / datetimefrom integer, to integer

Filtering example

For the product endpoint /api/productsthe query string to filter for the name cola would look like the following:


If you also want to filter for a specific project you can append the following query string to the previous one:


To filter by date, you may use something resembling the following:


Please, note that if you use Postman, you might have to encode the date "manually" 2023-01-01T00%3A00%3A00%2B01%3A00


Ordering can be done in ascending (ASC) or descending (DESC) direction. The ordering array describes a list of ordering criteria, where the first element is the most important ordering criteria, and the last the least important ordering criteria.

Represented as JSON the ordering object would be:

	order: [
  	{ "field": "companyName", "dir": "desc" },
  	{ "field": "createdAt", "dir": "asc" }


Represented as query string this would look like:



Pagination uses a page number and page size as a solution to describe the window of requested data. In the Xentral API the default page size is 10, the max page size is currently set to 50.

A page query where you would like to get the 5th page, with a page size of 10 would look like: