Normal view

Received — 13 September 2025 Drupal - Open Source Content Platform | #Celebr8D8

JSON API, filtering by relationships records possible?

Hello,

I've got two content types:
Houses, Flyers

Houses is mostly just address, name - that's it.
Flyers contains media field to upload files and a reference to a house.

So 1 House : n Flyers - Relationship.

Now, I'd like to use the API to retrieve all Flyers with a certain House ID.
I've got the ID, I can see all the Flyers via Postman, when I GET URL/jsonapi/node/flyer
and I can see inside each flyer:

 ... "field_something": "xyz" }, "relationships": { ... "field_house": { "data": { "type": "node--house", "id": "893aa231-e276-4f47-a3c0-efavfdv", "meta": { "drupal_internal__target_id": 960 } }, a aaa 

Somehow, I can filter by all fields inside attributes.
Is it possible to filter by by details inside relationships as well?

When I filter like:

flyer?filter[relationships.field_house.data.id]=893aa231-e276-4f47-a3c0-efavfdv

I get a response:

 "errors": [ { "title": "Bad Request", "status": "400", "detail": "Invalid nested filtering. The field `relationships`, given in the path `relationships.field_house.data.id`, does not exist.", 
submitted by /u/Chris8080
[link] [comments]
❌