Resolving a very deep relationship structure

Hi there,

I’m attempting to pull a content piece that has a very involved structure. I believe I’m getting confused by the path structure in the JSON vs. how the blocks are built.

You can find the data structure here:

I’m attempting to resolve the story in the media field. If I were using JSONPath it would be located here: story.content.body[2].programs[12].content.tabs[3].media

I’ve tried a number of variations similar to this

Is there not an easier way to identify components you want resolved without specifying the full path? In this whole data structure I basically need all the component stories.

Thanks for your help,


Hello David,

embedded relations which are inside of resolved relations can’t be resolved using the resolve_relations parameter. Instead oft that you can use the by_uuids parameter to fetch them separately:

Here is an example which shows how you can use it to get the stories of the media fields using their UUIDs:,94546af1-7233-43ea-acd3-f4e6439cae8b,a482c19a-609b-4938-bec5-2ad434306cae,1b8981b0-f95c-4597-98c4-9a8fe64ae0d4

Hi Hannes, thank you for answering so quickly. This unblocks me! It would be really nice if there was a way to recursively fetch these values. It would simplify the logic in my Next.js data resolvers.

You’re most welcome David!

There were already other people who asked about this possibility. Unfortunately there are technical hurdles which prevent this from becoming a possibility:

That’s understandable. At scale (as an engineer) I can see that it would be cumbersome. Perhaps a separate service designed specifically for resolving this issue? Story Resolver or something similar would make sense. Basically supply the base query and the service iterates through all the components and resolves relations.

That’s basically what I’ve written in my client but it’s slow and cumbersome given the amount of data we’re working with. Something that fetches the data and mitigates the 100-200ms round-trips to the UUID endpoint would save a bit of effort.

Given that SB has received many similar requests and given that this may mitigate effective and/or efficient utilisation of your service, I’d strongly recommend considering it. =)

Thanks again for your support.

1 Like