Autoflex
Was dit behulpzaam?

Filter parameter

How to filter your request? What is the syntax for the filter parameter?

Filter

A lot of REST/API endpoints for a GET on multiple entries have the ability to filter on the returned entries.

The filter always exists with one or more fields to filter on, e.g. field = value.

Input

ExpressionFilter to supply
field = valuefieldeq:value
field <> valuefieldnq:value
field <= valuefieldle:value
field >= valuefieldge:value
field like valuefieldlike:value (does only applies to string values)
field ilike valuefieldilike:value (does only applies to string values)
field in valuefieldin:value (multi value separated bij semi-colon ; )
field = "value with colon : or comma , "Surround value with double quotes
fieldeq:"value:,"
field = Supply value as two double quotes
fieldeg:""
field1=value or field2=valueSeparate two filters with comma and minus
field1eq:value,-field2eq:value
field1=value and field2=valueSeperate two filters with comma
field1eq:value,field2eq:value
(field1=value1 or field2=value1) and (field3=value3 or field4=value4)Use brackets
(field1eq:value,-field2eq:value),(field3eq:value,-field4eq:value)
field1 is nullfield1eq:null
NOTE: no quotes
field 1 not is nullfield1nq:null
NOTE: no quotes
field1 >= datecreated_datege:"2020-06-22"
field1 >= date + time (1)modified_datege:"2020-06-24T16:00:00"
or
modified_datege:"2020-06-24 16:00:00"
field1 >= date + time + milliseconds (1)modified_datege:"2020-06-24T16:20:10.123"
or
modified_datege:"2020-06-24 16:20:10.123"
field1 daterange date1, date2 (2)planning_start_datedaterange:planning_end_date;01-0-2025;2025-01-31
field1 containsrange date1, date2 (2)planning_start_datecontainsrange:2025-10-12;2025-10-31
field1 rangecontains date1, date2 (2)planning_start_daterangecontains:planning_ready_date;2025-10-12

Note 1

Date + Time, the best way to separate is with a "T"

But we do support a between Date+Time

Note 2

The filters daterange, containsrange and rangecontains do NOT support Date+Time ONLY use a Date

Formatting

ExtraExplanation
Text type fields (VARCHAR, TEXT)Alle diacritics are replaced with normal characters (using the zappdiacritics)
e.g. Citroën > Citroen
Field: LicenceplateAll minus characters are removed
e.g. KZ-313-X > KZ313X
like and ilike operatorsValues with the expression like and ilke are automatically supplied with %
e.g. fieldlike:"dam" > like "%dam%"
Date + timeDate and datetime fields have to be formated like this: yyyy-MM-dd HH:mm:ss.SSS

Samples

# Sample: Search on licence plate
license_plate[eq]:"kz-313-x"

# Sample: Search on two vehicle ID's with an OR expression
(-vehicle_id[eq]:60CEB4E9-9077-440E-9C01-29754A4C2EEE,-vehicle_id[eq]:E506CB2B-5972-4D17-9B06-6004B8978FFF)

# Sample: Find all vehicles without a brand, empty "" or null
(brand[eq]:"",-brand[eg]:null)

/# Sample: Find vehicles with brand Fiat or Volvo
(brand[eg]:"fiat",-brand[eg]:"volvo")

# Sample: Find vehicle created between januari and februari
created_date[ge]:"2019-01-01",created_date[le]:"2019-03-01"

# Sample: Find all articles without description
description[nq]:null

# Sample: search on id's (multiple seperated bij semi-colon ;) in table
user_id[in]:60CEB4E9-9077-440E-9C01-29754A4C2EEE;60CEB4E9-9077-440E-9C01-29754A4C2EEE

# Sample: find orders between daterange
filter=order_type[eq]:1,planning_start_date[daterange]:planning_end_date,2025-01-01,2025-31-01

Error messages

Error: QueryOperator not valid

Meaning: The block hooks are not valid

Error: Filter not valid

Meaning: Multiple filters are not separated correctly