When accessing a collection, you are able to filter on any field that is shown in the results using this format:[[FIELD, OPERATOR, VALUE], [FIELD, OPERATOR, VALUE]]
Example: ?filter=[["id","=",5],["name","=","my name"],["customer_number","in","abc123,cc00005"]]
The following operators are also available, but limited to the field type you are searching on. For example you cannot use <
with a boolean field.
"=", "<", ">","=<", "=>", "like", "ilike", "<>", "in"
Filtering by booleans is available with the following case insensitive values:
"yes", "y", "1", "true", 1, true, "false", "no", "n", "0", 0, false
Filtering can be done on multiple values by using the "in" operator and splitting the value by commas.
?filter=[["id","in","1,2,3,4,5"]] ?filter=[["customer_number","in","abc123,123abc,cc0000005"]] ?filter=[["exposure_zone.name","in","Washington,Arizona"]]
NOTE: Ids and numeric values need to be encapsulated in a string, ["id","in","1,2,3,4,5"] not ["id","in",1,2,3,4,5]
In some cases URL encoding may be required to make sure the filter JSON is valid:
?filter=[["name","=","Bob & Nicks Emporium"]]
Will cause an 'Invalid JSON' error so url encode the &
symbol:
?filter=[["name","=","Bob %26 Nicks Emporium"]]
Filtering by null
is also available, but it must be raw null
value (not in quotes).
?filter=[["customer_number","=",null]]
Filtering by "" can sometimes cause a PDO error:
?filter=[["calc_id","=",""]]
The solution is to change from an empty string to null
:
?filter=[["calc_id","=",null]]
Filtering based on expanded relationships is also available:
?filter=[["relationship.name", "=", "value"]]
NOTE: All of the expanded relationship filters are custom set white listed filters, if you feel you should be able to filter on something but can't, let us know at support@certcapture.com.
?filter=[["is_vendor","=","true"]]
NOTE: by default is_vendor is set to false on all requests.
?filter[["is_outgoing","=","true"]]
NOTE: by default is_outgoing is set to false on all requests.