Try our conversational search powered by Generative AI!

Returning nested blocks in Content Delivery API

Vote:
 

Is it possible to configure the Content Delivery API so that nested block information is returned? The documentation regarding the subject is rather diffuse, but to my understanding this should be achievable by ovveriding the Filter method in ContentApiModelFilter<ContentApiModel>. So far I've managed to remove null-values from the response but I have no idea on how to expand nested blocks in the response.

Basically, I want to expand the block information of answerOptions so that the API returns its properties:

{
    "contentLink": {
        "id": 12,
        "workId": 0,
        "guidValue": "fa94ca3f-6ba1-4d93-bfba-66556164f3ed",
        "url": "https://localhost:5000/en/package2/"
    },
    "name": "package2",
    "contentType": [
        "Page",
        "PackagePage"
    ],
    "url": "https://localhost:5000/en/package2/",
    "frames": {
        "expandedValue": [
            {
                "contentLink": {
                    "id": 1014,
                    "workId": 0,
                    "guidValue": "343f3bcf-2204-471b-847f-93bc910f9571"
                },
                "name": "pollblock",
                "contentType": [
                    "Block",
                    "PollBlock"
                ],
                "question": {
                    "value": "is this a question?",
                    "propertyDataType": "PropertyLongString"
                },
                "answerOptions": {
                    "value": [
                        {
                            "displayOption": "",
                            "contentLink": {
                                "id": 1012,
                                "workId": 0,
                                "guidValue": "4a4e1407-f1ff-427f-bf33-e84286774ba7"
                            }
                        },
                        {
                            "displayOption": "",
                            "contentLink": {
                                "id": 1013,
                                "workId": 0,
                                "guidValue": "35e1b241-2052-4300-bdaf-f5da72dabf7a"
                            }
                        }
                    ],
                    "propertyDataType": "PropertyContentArea"
                }
            },
            {
                "contentLink": {
                    "id": 14,
                    "workId": 0,
                    "guidValue": "d1cac50a-1bb9-46d1-85fb-3caeb6fa0c52"
                },
                "name": "endframe2",
                "contentType": [
                    "Block",
                    "EndFrameBlock"
                ],
                "text": {
                    "value": "test",
                    "propertyDataType": "PropertyLongString"
                }
            }
        ],
        "value": [
            {
                "displayOption": "",
                "contentLink": {
                    "id": 1014,
                    "workId": 0,
                    "guidValue": "343f3bcf-2204-471b-847f-93bc910f9571"
                }
            },
            {
                "displayOption": "",
                "contentLink": {
                    "id": 14,
                    "workId": 0,
                    "guidValue": "d1cac50a-1bb9-46d1-85fb-3caeb6fa0c52"
                }
            }
        ],
        "propertyDataType": "PropertyContentArea"
    },
    "categories": {
        "value": [
            {
                "displayOption": "",
                "contentLink": {
                    "id": 11,
                    "workId": 0,
                    "guidValue": "c919c611-7833-4953-b690-d2c6097fb642"
                }
            }
        ],
        "propertyDataType": "PropertyContentArea"
    }
}
#287437
Sep 15, 2022 12:09
Vote:
 

I wrote an addon for 3.0 that does this. You've referenced 2.9, try upgrading to 3.0 if you can and give it a go: https://www.hiddenfoundry.com/thoughts/expand-content-area-addon-for-content-delivery-api/

#287708
Sep 20, 2022 11:40
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.