Constraints

Introduction

Similar to Value Filters, constraints are used to alter the query of a GET Request to fetch the required data for a specific use-case.

They are slightly different from Value Filters, as they enable the user to set constraints which are not aimed on a single field value but on relations or many fields.

Every constraint can be combined with Value Filters as seen below.

Definition

  • {route} - The endpoint you want to retrieve data of

  • ?filter - To identify the incoming URL parameter

  • [{constraint}] - One of the constraints from the listing below

  • [{field}] - The field (or relation field) on which the constraint should be applied

  • [{valueFilter}] - (Optional) Field value filters for related entries

  • {value} - Value depending on applied filters and constraints

GET /api/{route}?filter[{constraint}][{field}][{valueFilter}]={value}

Doesn't Have

Constraint that manipulates the Query so that only the entries which doesn't have a relation to the given relation will get returned.

If you want to add a simple doesnt_have constraint without further conditions on specific field values you can just pass the value 1.

GET /api/{route}?filter[doesnt_have][{field}]={value}

Has

Constraint that manipulates the Query so that only the entries which have a relation to the given field will get returned.

If you want to add a simple has constraint without further conditions on specific field values you can just pass the value 1.

GET /api/{route}?filter[has][{field}]={value}

Where One Of

Constraint that manipulates the Query, so that only the entries which have a relation to one of the given fields, will get returned.

This can be combined with Value Filters to add conditions on field values of the given relation keys.

Accepts a comma seperated list of relations.

GET /api/{route}?filter[where_one_of][{fields}]={value}

Last updated