0

I am trying to get all page component details including child component details. returnChildRegionComponents parameter was set to true in components in request.

But the returned response is missing child component details. It contains only 'id' and 'title' fields. There is no difference between true and false for returnChildRegionComponents.

Is there any way to get all child component details?

query ($namespaceId: Int!, $publicationId: Int!, $pageId: Int!) {
    page(namespaceId: $namespaceId, publicationId: $publicationId, pageId: $pageId) {
        itemId
        title
        url
        regions {
            name
            components(returnChildRegionComponents:true) {
                itemId
                multiMedia
                ... on Component {
                    content { ... on UntypedContent {
                            type
                            data
                        }
                    }
                }
            }
        }
    }
}

Response

{
    "data": {
        "page": {
            "itemId": 231,
            "title": "Title",
            "regions": [
                {
                    "name": "Region 1",
                    "components": [
                        {
                            "itemId": 178,
                            "multiMedia": false,
                            "content": {
                                "type": "Fields",
                                "data": {
                                    "$type": "Fields",
                                    "TemplateName": "ImageLink",
                                    "Image": {
                                        "$type": "Link",
                                        "id": "tcm:2-175",
                                        "title": "Banner"
                                    },
                                    "ExternalURL": "www.google.com",
                                    "LinkTarget": "Yes"
                                }
                            }
                        }
                    ]
                },
                {
                    "name": "Region 2",
                    "components": [
                        {
                            "itemId": 235,
                            "multiMedia": false,
                            "content": {
                                "type": "Fields",
                                "data": {
                                    "$type": "Fields",
                                    "TemplateName": "Region2 Template",
                                    "titleStr": "Region 2 Title",
                                    "events": {
                                        "$type": "Link[]",
                                        "$values": [
                                            {
                                                "id": "tcm:2-212",
                                                "title": "Event 1"
                                            },
                                            {
                                                "id": "tcm:2-220",
                                                "title": "Event 2"
                                            },
                                            {
                                                "id": "tcm:2-234",
                                                "title": "Event 3"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    ]
                }
            ]
        }
    }
}
1
  • Where are you seeing any documentation for the returnChildRegionComponents ? Apr 12 at 10:23

1 Answer 1

0

I'm not seeing any documentation for the returnChildRegionComponents.

When you have more complex logic or data retrieval requirements for retrieving the additional details, you can implement custom resolvers in the GraphQL server. These are responsible for fetching data from the underlying data sources and can be used to retrieve additional details based on the reference ID provided in the query above.

The obvious option would be that you'd have to code to iteratively return each instance in its own request/response. I guess that you could make this more efficient by creating a GraphQL Type to consolidate the call for an array of event IDs and return them as a single collection also.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.