drupaljson-api

Drupal9 JSON:API filtering on Paragraphs content


I have a json api endpoint that I can search on title that contains a term: /jsonapi/node/article?filter[title][operator]=CONTAINS&filter[title][value]=search term

But I also have a Paragraphs field that I need to use in the filter, so if the title or Paragraphs field contain the search term then return the article

I have tried various way of filtering against the Paragraph field but can't get anything back: filter[paragraph_field][operator]=CONTAINS&filter[paragraph_field][value]=search term

I'm sure this is possible as one of the Features of Paragraphs is stated as 'Entities, so: exportable field bases/instances, usable in Search API, usable in Views'


Solution

  • I figured it, there was a hint in the error; it's a matter of getting the path correct in the key:

    ?filter[field_paragraphs.field_body.value][operator]=CONTAINS
    &filter[field_paragraphs.field_body.value][value]=search term