logical operators.md
Logical operators
Logical and comparison operators are used inside $filter expressions.
Operators
| Operator | Meaning | Example |
|---|---|---|
eq |
Equal to | cat_ref eq 'ABC' |
ne |
Not equal to | cat_ref ne 'ABC' |
gt |
Greater than | createdOn gt '2025-01-01' |
lt |
Less than | createdOn lt '2025-01-01' |
ge |
Greater than or equal to | createdOn ge '2025-01-01' |
le |
Less than or equal to | createdOn le '2025-01-01' |
and |
Both conditions must match | cat_ref eq 'A' and cat_title eq 'Products' |
or |
Either condition may match | cat_ref eq 'A' or cat_ref eq 'B' |
in |
Value is in a list | cat_ref in ('A','B') |
Syntax
$filter=PROPERTY_NAME operator VALUE
Examples
GET https://api2.saleslayer.com/catalog/Categories?$filter=cat_title eq 'Products' or cat_ref eq 'LPG'
GET https://api2.saleslayer.com/dam/images?$filter=status eq 'Ok'
Notes
- Use operators with fields whose data type supports the comparison.
- Use metadata and the OpenAPI reference to confirm available fields.
- Parentheses can make complex expressions easier to read and safer to maintain.