Resolve Relations
You can use resolve relations for a specific story by using the resolve_relations
parameter with the relation to be resolved as the value for the argument. For example, if you have a “Featured Notes” component which has a field for adding notes to be featured, you can get the details of the individual notes by using resolve_relations
like this:
query {
PageItem(id: "542305440", resolve_relations: "FeaturedStickyNotes.featured_notes") {
content {
body
}
}
}
This would result in a response containing each featured note's details:
...
{
"_uid": "53d19937-a78e-4ffe-a33b-aae049fa3442",
"component": "FeaturedStickyNotes",
"featured_notes": [
{
"name": "StickyNote1",
"created_at": "2024-11-04T12:11:59.435Z",
"published_at": "2024-11-08T16:22:56.496Z",
"alternates": [],
"id": "573178675",
"uuid": "8e565277-6a08-4e3a-9775-6482647cb5a7",
"content": {
"_uid": "c23e79f4-d02f-41bd-b478-7e707bf12ec3",
"note": "Hello",
"component": "StickyNote",
"_editable": "<!--#storyblok#{\"name\": \"StickyNote\", \"space\": \"302787\", \"uid\": \"c23e79f4-d02f-41bd-b478-7e707bf12ec3\", \"id\": \"573178675\"}-->"
}
}
]
}
...
Related Resources
References Concept
Learn how to resolve relations in the references concept.