goomento/module-page-builder-api

为 Goomento 的 Magento 页面构建扩展提供的 Rest API 和 GraphQL。

安装数量: 5,373

依赖项: 1

建议者: 0

安全性: 0

星标: 1

关注者: 0

分支: 2

开放问题: 0

类型:magento2-module

1.0.2 2023-05-21 14:17 UTC

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_contentsettings_content 是页面构建器的编码 JSON 数据