API query for searching referenced content from main content

Hi All,
I am somewhat new to references subject within the Contentful… I am looking for a quick help on how to search for a referenced content. Thanks in advance, here is the scenario.

Main content_type: “person”, which has a fields 1) name “Short Text” and a 2) “videos” field which is defined as reference , infact we can have many such videos for a person content not just one video. Now these “videos” fields point to another content_type called “video” which has two fields video “title” and “videoURL” for that video.

I need to build a search API to get the value of “videoURL” based on two criteria i.e person.name + video.title . This is because the same person can have many “videos” pointing to different video contents , however I am interested in a video delivered by that person which has a particular title.

I tried many combinations, but missing the link between the main content person and the child content video. Can you please help me to build this API so that I can use postman API platform , to test using GET request . Thanks a lot I appreciate your help.

Have you tried using links to specific item? This should allow you query for all videos by a specific person (once you have the person entry’s ID, which could require an initial query), then from there you could further refine that data set based on video title using frontend logic :thinking:

Hi Eric, Thanks a lot for your suggestion . I see something similar was suggested on contentful website also
However, we dont want to have this refinement logic in the front end actually. Our requirement is that we create APIs and have the front end applications call these APIs thru API Manager.

Here is an example API, using content_type=Video and if you try this in postman, or graphql it is returns the videoUrl

https://cdn.contentful.com/spaces/{spaceid}/environments/{env}/entries?content_type=Video&fields.title=Fifa World Cup Qatar 2022 Nora Fatehi Wins Hearts With Her Electrifying Performance At Fifa Fanfest Videos Go Viral&select=fields.videoUrl

But I need to create similar API which can get the videoUrl drilling down directly right from content_type=person. instead of content_type=video… bcoz the field “videos” of person content type… intern references to many such videos like the one listed above.

I am trying below API… to search for a person first and then by matching the sys ids of videos and then get the videoUrl from video title but it’s not working=>

https://cdn.contentful.com/spaces/{spaceid}/environments/{env}/entries?content_type=person&fields.name=Nora Fatehi&fields.videos.sys.id=includes.sys.id&fields.video.title=Fifa World Cup Qatar 2022 Nora Fatehi Wins Hearts With Her Electrifying Performance At Fifa Fanfest Videos Go Viral&select=fields.videoUrl

PLEASE SEE THE ATTACHED IMAGE for more information about the person structure.

Thanks in advance,