String functions

String functions

String functions filter resources based on text values in supported fields. Use them inside $filter expressions.

Supported functions

Function Meaning Example
contains Matches values that contain a substring. contains(prod_title,'EC')
startswith Matches values that start with a prefix. startswith(cat_ref,'C')
endswith Matches values that end with a suffix. endswith(prod_ref,'-EN')

Syntax

FUNCTION_NAME(PROPERTY_NAME,'VALUE')

Examples

GET https://api2.saleslayer.com/catalog/Products?$select=prod_ref,prod_title&$filter=contains(prod_title,'EC')
GET https://api2.saleslayer.com/catalog/Categories?$filter=startswith(cat_ref,'C')
GET https://api2.saleslayer.com/dam/images?$filter=contains(reference,'product')

Combining with logical operators

String functions can be combined with logical operators:

startswith(cat_ref,'C') and contains(cat_title,'Shoes')

Notes