Features
Technical summary of OData parameters
$select
Allows to specify which properties of a resource should be included in the response, reducing the volume of data. It is used as part of the URL
Example:
?$select=[prod_ref,prod_title]
Check the metadata (/$metadata) to know the names of the available properties.
🔗 More information in the official documentation
$filter
Applies filtering criteria to the returned resources.
Supports logical operators such as eq, ne, gt, lt, ge, le, and, or, and set operators such as in.
Example:
?$filter=[category eq 'electronics' and price gt 100]
It can be combined with string functions like startswith() or contains() for more advanced filters.
🔗 More information in the official documentation
$orderby
Allows to sort the results by one or several properties.
Useful to control the order in which the data is returned, improving the clarity of the responses.
Example:
?$orderby=price desc
🔗 More information in the official documentation
$expand
Allows to include related collections (embedded collections) of a resource in the response.
By default, these collections are not returned unless explicitly requested.
It only supports collections, not individual resources.
Example:
?$expand=[Variants]
🔗 More information in the official documentation
Pagination ($skip, $top, $skipToken, etc.)
Controls the quantity and offset of the returned results:
$skip: Skips a specified number of results.
$top: Limits the number of results returned.
$skipToken: Enables token-based pagination for large datasets.
Essential for efficiently handling large volumes of data.
🔗 More information in the official documentation
The REST API supports two main pagination strategies to efficiently handle a high volume of data. Both strategies allow customizing the pagination behavior according to the specific needs of each implementation. For large datasets or frequent access, token-based pagination is recommended as it provides optimal performance.
1.-Token based pagination (recommended)
- Uses the $skipToken parameter to navigate between pages.
- This method is faster and more efficient compared to limit-based pagination.
- The pagination token is obtained from the @nextLink field included in the API response.
Example:
http://api2.saleslayer.com/rest/Catalog/Products?
$select=[prod_ref,cat_ref,prod_description]&
$skipToken=[1]
2.-Limit based pagination
- Uses the $top parameter to specify the maximum number of items to retrieve per page.
- You can also use $skip to manually omit a specific number of records.
Example:
http://api2.saleslayer.com/rest/Catalog/Products?
$select=[prod_ref,cat_ref,prod_description]&
$skip=[1]&
$top=[1]
Other filtering and pagination functions
Logical operators
Logical operators are used to combine conditions or compare property values in filtering expressions. They are applied according to the data type of the corresponding property.
Supported functions
Operator | Description | Example Usage |
eq | Equal to | property eq 'value' |
ne | Not equal to | property ne 'value' |
gt | Greater than | property gt 10 |
lt | Less than | property lt 10 |
ge | Greater than or equal to | property ge 10 |
le | Less than or equal to | property le 10 |
and | Logical AND | property1 eq 'value1' and property2 lt 5 |
or | Logical OR | property1 eq 'value1' or property2 gt 10 |
in | Matches any value in a list | property in ('value1', 'value2') |
More information here for all usage examples.
String functions
String functions allow filtering based on the text content present in the root resource properties. These functions are especially useful when working with string-based fields, as they enable more precise searches and filtering.
More information: here for all usage examples.