0

I'm using the JSON:API module (in core since Drupal 8.7), which works well for a Retrieve all articles with title that contains "MyKeyValue" or subtitle that contains "MyKeyValue" which, translated in JSON:API query becomes:

fields[node--article]=title,field_subtitle
filter[or-group][group][conjunction]=OR
filter[status][value]=1
filter[title-filter][condition][path]=title
filter[title-filter][condition][operator]=CONTAINS
filter[title-filter][condition][value]=MyKeyValue
filter[title-filter][condition][memberOf]=or-group
filter[subtitle-filter][condition][path]=field_subtitle
filter[subtitle-filter][condition][operator]=CONTAINS
filter[subtitle-filter][condition][value]=MyKeyValue
filter[subtitle-filter][condition][memberOf]=or-group

How do I manage multi-values within the CONTAINS condition, for a query like the following one?

Retrieve all articles with title that contains ("MyKeyValue" AND "AnotherKeyValue") or subtitle that contains ("MyKeyValue" AND "AnotherKeyValue")

I tried to pass multiple values in this way, but it doesn't work.

filter[title-filter][condition][operator]=CONTAINS
filter[title-filter][condition][value][]=MyKeyValue
filter[title-filter][condition][value][]=AnotherKeyValue
0

Just change field name and values if you want change the custom name also here its profile status filter.

filter[profileStatusFilter][condition] 
[path]=first_field&filter[profileStatusFilter2][condition] 
[path]=second_field&filter[profileStatusFilter][condition] 
[operator]=CONTAINS&filter[profileStatusFilter2][condition] 
[operator]=CONTAINS&filter[profileStatusFilter][condition] 
[value]=first_value&filter[profileStatusFilter2][condition] 
[value]=second_value&filter[profileStatusFilter][condition][memberOf]=billing- 
group&filter[profileStatusFilter2][condition][memberOf]=billing-group
2
  • Sorry but if you move rows in your code above with the same order like i wrote in my question you obtain EXACTLY what I've already wrote. So this doesn't answer my question
    – MXT
    Jun 28 '19 at 8:36
  • ohhh i just copied my working code , i tested in postman too. Check with jsonapi versioning then.
    – Rifas Ali
    Jun 28 '19 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.