Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 31 Next »

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

Introduction

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.

Usage

Expression

Filter to supply

field = value

field[eq]:value

field <> value

field[nq]:value

field <= value

field[le]:value

field >= value

field[ge]:value

field like value

field[like]:value

field ilike value

field[ilike]:value

field in value

field[in]:value
(multi value separated bij semi-colon ; )

field = "value with colon : or comma , " 

Surround value with double quotes

field[eq]:"value:,"

field = <empty>

Supply value as two double quotes

field[eg]:""



field1=value or field2=value

Separate two filters with comma and minus

field1[eq]:value,-field2[eq]:value

field1=value and field2=value

Seperate two filters with comma

field1[eq]:value,field2[eq]:value

(field1=value1 or field2=vlaue1)

Use brackets

(field1[eq]:value,field2[eq]:value)

field1 is null

field1[eq]:null

NOTE: no quotes

field 1 niet null

field1[nq]:null

NOTE: no quotes

field1 >= date

created_date[ge]:"2020-06-22"

field1>= date + time

modified_date[ge]:"2020-06-24T16:00.00"


Extra

Explanation

Text type fields (VARCHAR, TEXT)

Alle diacritics are replaced with normal characters (using the zappdiacritics)

e.g. Citroën > Citroen

Field: Licenceplate

All minus characters are removed

e.g. KZ-313-X > KZ313X

like and ilike operators

Values with the expression like and ilke are automatically supplied with % <percent>

e.g. field[like]:"dam" > like "%dam%"

Samples

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

// 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)

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

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

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

// Find all articles without description
description[nq]:null

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

Error messages


Error: QueryOperator not valid

Meaning: The block hooks are not valid

Error: Filter not valid

Meaning: Multiple filters are not separated correctly


Related articles

  • No labels