When filtering using the API, we offer the following three options to assist you in querying your data:
For sample requests, please see the code samples section.
Filter
The
filterobject accepts eitheroperatorandoperandsas group expressions or it acceptsfieldandcomparatorandvalueas field-value comparisons.
Group expressions:
operatorAn optional string whose values can be eitherandoror.operandsIs a list of self referencing filter objects.
Field-value comparison:
fieldThe key which you would like to search against.comparatorA comparator enum value.valueA value you would like to filter against.
{
"operator": (optional)string,
"operands": (optional)[]filter,
"field": (optional)string,
"comparator": (optional)string,
"value": (optional)any,
}
Pagination
page accepts the following:
offsetThe number of results to skip over.limitThe number of results to return.
{
"offset": (optional)int,
"limit": (optional)int,
}
Sort
When using sort, you can use multiple sort objects to order your outputs in your preferred order. It is important to remember that null values are considered the lower possible value. When using the asc direction null values will appear first, and when using desc they will appear last.
[]sort accepts the following:
fieldis the field by which you would like to sort.directionthe direction in which you would like the results returned. This can be eitherascordesc.
[
{
"field": string,
"direction": enum,
}
]
Comparators
| Comparator | Description |
|---|---|
| eq | equal |
| ne | not equal |
| gt | greater than |
| ge | greater or equal |
| lt | less than |
| le | less than or equal |
| contains | contains |
| not_contains | does not contain |
| is_any | is any (compare a single element against an array) |
| is_not_any | is not any (compare a single element against an array) |
| includes_any | includes any (array) |
| includes_all | includes all (array) |
| excludes_any | excludes any (array) |
| excludes_all | excludes all (array) |
| eq_date | equals date |
| ne_date | does not equal date |
| rp_eq_date | relative past equal date |
| rp_lt | relative past less than date |
| rp_gt | relative past greater than date |
| rf_eq_date | relative future equal date |
| rf_lt | relative future less than date |
| rf_gt | relative future greater than date |
Code Samples
Find a supplier by name
Using the filter rule, we can find a supplier by name:
{
"filter": {
"field": "name",
"comparator": "eq",
"value": "ACME Corp"
}
}
Find suppliers with more than 3 remediation requests
{
"filter": {
"field": "numRemediationRequests",
"comparator": "gt",
"value": 3
}
}
Find suppliers who have not yet approved a connection, who are located in London and return them two at a time in descending order
{
"filter": {
"operator": "and",
"operands": [
{
"field": "approvalStatus",
"comparator": "eq",
"value": "unapproved"
},
{
"field": "city",
"comparator": "eq",
"value": "London"
}
]
},
"page": {
"offset": 0,
"limit": 2
},
"sort": [
{
"field": "connectedAt",
"direction": "desc"
}
]
}
