Skip to content

Public Rest API and GraphQL for Goomento - Magento Page Builder Extension

License

Notifications You must be signed in to change notification settings

Goomento/PageBuilderApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Public REST API and GraphQL for Goomento Page Builder Extension

1. Install

Run the following command in Magento 2 root folder to install this repository

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 request

Get JSON data of particular Goomento page builder base on identifier via REST API

Request:

GET <domain>/rest/V1/<store_code>/pagebuilder/identifier/<identifier>

Example response:

{
    "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 request

Get JSON data of particular Goomento page builder base on identifier via GraphQL

Request:

query {
    pagebuilder(identifier: "<identifier>") {
        title
        status
        type
        html
        elements_content
        settings_content
        creation_time
        update_time
        styles {
            content
            href
        }
    }
}

Example response:

{
    "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};"
                }
            ]
        }
    }
}

Note:

  • Publish status must be Yes
  • Enable config must be Yes
  • elements_content and settings_content were encoded JSON data of page builder