goomento / module-page-builder-api
为 Goomento 的 Magento 页面构建扩展提供的 Rest API 和 GraphQL。
1.0.2
2023-05-21 14:17 UTC
Requires
- goomento/module-page-builder: >=0.4.3
This package is auto-updated.
Last update: 2024-09-21 17:09:13 UTC
README
1. 安装
在 Magento 2 根目录下运行以下命令以安装此存储库
composer require goomento/module-page-builder-api php bin/magento module:enable Goomento_PageBuilderApi php bin/magento setup:upgrade php bin/magento setup:static-content:deploy
2. REST API 请求
通过 REST API 根据标识符获取特定 Goomento 页面构建器的 JSON 数据
请求
GET <domain>/rest/V1/<store_code>/pagebuilder/identifier/<identifier>
示例响应
{
"settings": {},
"elements": [],
"title": "Goomento page builder response",
"type": "page",
"status": "publish",
"update_time": "2022-09-02 08:50:59",
"creation_time": "2022-09-02 08:50:59",
"html": "<div>Page Builder HTML.</div>",
"styles": [
{
"href": "https://example.com/pub/style.css",
"content": "body {background: red};"
}
]
}
3. GraphQL 请求
通过 GraphQL 根据标识符获取特定 Goomento 页面构建器的 JSON 数据
请求
query { pagebuilder(identifier: "<identifier>") { title status type html elements_content settings_content creation_time update_time styles { content href } } }
示例响应
{
"data": {
"pagebuilder": {
"title": "Goomento page builder response",
"status": "publish",
"type": "page",
"html": "<div>Page Builder HTML.</div>",
"elements_content": "[]",
"settings_content": "{}",
"creation_time": "2022-09-02 08:50:59",
"update_time": "2022-09-02 08:50:59",
"styles": [
{
"href": "https://example.com/pub/style.css",
"content": "body {background: red};"
}
]
}
}
}
注意
发布状态必须是是启用配置必须是是elements_content和settings_content是页面构建器的编码 JSON 数据