Output filters

Last updated on
25 March 2022
Optional filter available:
  • offset, integer: Controls the search offset, aka the item count to skip.
    • default value: 0
  • limit, integer: The item count we want.
    • default value: NULL (no limit)
  • display, string: machine name of entity display to output
    • default value: "decoupled"

If you want more precise filtering, you can filter by field values.
The system is analoguous to the entity queries (it is in fact a sort of
wrapper).

To add a field filter, add to the query parameters:

  • filter[{index}][f]={field machine name}
  • filter[{index}][v]={single value}
  • filter[{index}][c]={condition}

Placeholder explanations:

  • index, integer: For each field filter, you need to set the index, starting
      by 0 for the first field, then 1, then 2, etc.
  • field machine name, string: The field machine name on the entity.
  • value, mixed: The value of the filter.
  • condition, string, optional: One of the possible conditions that are
      offered by entity query: '=', '<>', '>', '>=', '<', '<=', 'STARTS_WITH',
      'CONTAINS', 'ENDS_WITH', 'IN', 'NOT IN', 'BETWEEN'. Uses '=' if not set.

To use the 'IN' and 'NOT IN' conditions, the value syntax is (notice the
brackets):

  • filter[{filter_index}][v][]={value 1}
  • filter[{filter_index}][v][]={value 2}
  • filter[{filter_index}][v][]={etc}

Examples:

  • filter[0][f]=title
  • filter[0][v]=Title%20of%20the%20content
  • filter[1][f]=field_tag
  • filter[1][v][]=10
  • filter[1][v][]=1337
  • filter[1][c]=IN

... which gives in a full path:
/decoupled-api/node/article/collection?offset=0&limit=500&filter[0][f]=title&filter[0][v]=Title%20of%20the%20content&filter[1][f]=field_tag&filter[1][v][]=10&filter[1][v][]=1337&filter[1][c]=IN

Help improve this page

Page status: No known problems

You can: