The filter request argument is used to apply a filter to Oomnitza REST API operations. The filter operation follows a syntax similar to SQL and is comprised of three components:
- The property or field name
- The operator such as eq, lte, gte
- The filter value
Filtering examples
The following are examples of valid filter operations:
https://mycompany.oomnitza.com/api/v3/assets?filter=barcode IS NULL
. Returns records where the barcode(s) is empty.https://mycompany.oomnitza.com/api/v3/assets?filter=Barcode LIKE “A%” OR barcode LIKE “B%”
. Returns records where the barcode(s) starts with 'A' or 'B'.https://mycompany.oomnitza.com/api/v3/assets?filter=Barcode IN [“123”, “ABC”, “XYZ”]
. Returns records where the barcode(s) matches the following value.https://mycompany.oomnitza.com/api/v3/assets?filter=date BETWEEN 01/01/2010 AND 01/02/2020
. Returns record(s) purchased between the supplied dates.https://mycompany.oomnitza.com/api/v3/users?filter=first_name eq '{{first_name}}'
. Returns record(s) where the name equals the value stored in the first name field in Oomnitza.
Consider encoding and special characters when filtering
If you use the filter to retrieve values that contain special characters, it is recommended to utilize the urlencode function in the request. Otherwise, you may receive 400 bad request errors when making the API request in Oomnitza. For example, if you have tried to fetch a contract name that has a special character in the value, such as "Sales & Co", try changing the request to https://mycompany.oomnitza.com/api/v3/contracts?filter=contract_name eq '{{contract_name|urlencode}}'
. Alternatively, consider using the Oomnitza API block. The Oomnitza block provides enables you to access all of the endpoints listed in the Swagger documentation, without the need to enter your credentials or consider encoding. For more information, refer to the Oomnitza block.
Supported filter operations
API Filter Operator |
Description |
eq |
Equals value |
neq |
Does Not Equal value |
in |
Is In [list] |
like |
LIKE value (SQL LIKE) |
lt |
Is Less Than value |
gt |
Is Greater Than value |
lte |
Is Less Than or Equal To value |
gte |
Is Greater Than or Equal To value |
is NULL |
Is Empty |
isnt NULL |
Is Not Empty |
between [date] AND [date] |
Date field is between the two dates |
between [number] AND [number] |
Numeric field is between the two dates |
Comments
0 comments
Please sign in to leave a comment.