The API mechanism is based on oData v4 standards, which means that filtering, selecting, sorting and pagination follow the
principles as defined by
OASIS open.
For convenience, we will explain in short what this means in commun usages. For all details the official documentation has
to be read.
Filtering data
Using GET parameter: $filter
To limit the to be responded data one can specify the $filter parameter, which can be used to specifiy the filters to
apply.Each field available within an endpoint can be used in the filter.
A short overview of commonly used operators:
Operator
|
Description
|
Example |
Comparison Operators |
eq
|
Equal
|
Address/City eq 'Redmond'
|
ne
|
Not equal
|
Address/City ne 'London'
|
gt
|
Greater than
|
Price gt 20
|
ge
|
Greater than or equal
|
Price ge 10
|
lt
|
Less than
|
Price lt 20
|
le
|
Less than or equal
|
Price le 100
|
has
|
Has flags
|
Style has Sales.Color'Yellow'
|
Logical Operators |
and
|
Logical and
|
Price le 200 and Price gt 3.5
|
or
|
Logical or
|
Price le 3.5 or Price gt 200
|
not
|
Logical negation
|
not endswith(Description,'milk')
|
Arithmetic Operators |
add
|
Addition
|
Price add 5 gt 10
|
sub
|
Subtraction
|
Price sub 5 gt 10
|
mul
|
Multiplication
|
Price mul 2 gt 2000
|
div
|
Division
|
Price div 2 gt 4
|
mod
|
Modulo
|
Price mod 2 eq 0
|
Grouping Operators |
( )
|
Precedence grouping
|
(Price sub 5) gt 10
|
Source and full documentation/all operators
Sorting data
Using GET parameter: $orderby
Within the $orderby parameter all fields available in an endpoint can be used to sort on.
Examples:
- sort on the field `change_date_time` in descending order:
$orderby=change_date_time desc
- Order on newest per entry date, but per day on change date:
$orderby=entry_date desc, change_date_time asc
Paginating data
Using GET parameters: $skip and $top
By limiting the number of results per response with the parameter $top, and the number of to be skipped results with $skip,
it's possible to fetch all the available data in manageable batches.
- Get the first page (or batch, set) of data, containing 100 items:
$skip=0&$top=100
- Get the second page of data:
$skip=100&$top=100
- Get the nineth page of data:
$skip=800&top=100
Select specific fields of the data
Using GET parameter: $select
By default all fields available will be returned. For performance or security reasons it's possible to limit the to be
responded data by specifieng the to be returned fields with $select.
- Return only the product name and group code:
$select=name,product_group_id
-
Return only the company name and postal code: $select=name,postal_identification_code