1

I have a "user_group" paragraph type which has a user node reference field called "field_group".

Then each user has a paragraph reference field called "field_groups".

So, something like this:

User: field_groups -> paragraph reference with a field_group node reference

Now I need to retrieve all users that have a paragraph which references a given node. So I'm using this JSON:API request:

/jsonapi/user/user?filter[field_groups.field_group.id]={some-node-id}

But it doesn't return anything. I've also tried:

/jsonapi/user/user
?filter[group][condition][path]=field_groups.field_group.id
&filter[group][condition][value]={some-node-id}

Which also doesn't return anything.

Any idea on what I'm missing?

Update:

I've tried to retrieve paragraphs that reference the node directly:

/jsonapi/paragraph/user_group?filter[field_group.id]={some-node-id}

But this also didn't return anything... There's no error, but no data returned

2
  • I haven't worked with jsonapi much. But knowing Drupal a bit, iiuc: field_groups references a Paragraph entity of bundle user_group which has a field called field_group which references a Node entity. So try this notation field_groups.entity.field_group.entity.id – Beebee Oct 13 '20 at 20:39
  • Thanks for the tip! Unfortunately this doesn't seem to work either. No error, but no data returned. – Hubert Oct 14 '20 at 14:15

Your Answer

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

Browse other questions tagged or ask your own question.