首页 > 解决方案 > Pimcore REST API:使用块创建对象

问题描述

我正在尝试通过 pimcore rest api 创建一个新对象。

我试图创建的对象包含块。对象已创建,但应出现在块中的内容未创建。

{
"className": "TrainingCourseMaterial",
"parentId": -1,
"key": "Slides",
"published": true,
"data": {
    "elements": [{
        "type": "block",
        "value": [{
                "contentlanguage": "de",
                "slides": [{
                        "image__image": 1859,
                        "image__hotspots": {
                            "hotspots": [],
                            "marker": [],
                            "crop": []
                        }
                    },
                    {
                        "image__image": 1860,
                        "image__hotspots": {
                            "hotspots": [],
                            "marker": [],
                            "crop": []
                        }
                    },
                    {
                        "image__image": 1861,
                        "image__hotspots": {
                            "hotspots": [],
                            "marker": [],
                            "crop": []
                        }
                    },
                    {
                        "image__image": 1862,
                        "image__hotspots": {
                            "hotspots": [],
                            "marker": [],
                            "crop": []
                        }
                    },
                    {
                        "image__image": 1863,
                        "image__hotspots": {
                            "hotspots": [],
                            "marker": [],
                            "crop": []
                        }
                    },
                    {
                        "image__image": 1864,
                        "image__hotspots": {
                            "hotspots": [],
                            "marker": [],
                            "crop": []
                        }
                    },
                    {
                        "image__image": 1865,
                        "image__hotspots": {
                            "hotspots": [],
                            "marker": [],
                            "crop": []
                        }
                    },
                    {
                        "image__image": 1866,
                        "image__hotspots": {
                            "hotspots": [],
                            "marker": [],
                            "crop": []
                        }
                    },
                    {
                        "image__image": 1867,
                        "image__hotspots": {
                            "hotspots": [],
                            "marker": [],
                            "crop": []
                        }
                    },
                    {
                        "image__image": 1868,
                        "image__hotspots": {
                            "hotspots": [],
                            "marker": [],
                            "crop": []
                        }
                    },
                    {
                        "image__image": 1869,
                        "image__hotspots": {
                            "hotspots": [],
                            "marker": [],
                            "crop": []
                        }
                    }
                ]
            }

        ],
        "name": "SlidesBlock",
        "language": null
    }]
}
}

不确定这是否可能。最后的手段是使用 admin api。

标签: pimcorepimcore-v5

解决方案


推荐阅读