On this page

How to build a Remote App

Remote App is similar to Standard App but uses remote API for all operations. This means you can connect your app to an API endpoint running on a different server and the API can be powered by any programming language. Remote App provides a flexible way to develop an app and let other companies to connect their existing applications to the SiteGUI platform.

Remote App can be activated and used for your own site right away, it must be published to the Appstore before it can be used on sites not owned by you.

Required Operations

The remote API endpoint should support the following operations: config, update, edit, render and renderCollection. Each API call include a JSON input named "json" that contains the information for the Site utilizing the API (site_config) and other applicable data (e.g: submitted user data). The expected responses should be the same as the responses from the Standard App's methods, i.e: an array of SiteGUI ViewBlocks attached to supported ViewPositions for edit, render, renderCollection operations or an array of config/record data for config/update operations. All responses should include a key named "result" with the value "success" to indicate a successful operation.

Sample Request Data

  {
    "site_config": {
        "site": {
            "id": 123,
            "name": "Sample",
            "url": "sample.com",
            "language": "en",
            "...": "other site properties"
        },
        "app": {
            "custom_config": "defined by your app",
            "config2": 2,
            "token": "your_assigned_token",
            "...": "other config values"
        }
    },
    "id": 123,
    "slug": "xyz",
    "content": "sample",
    "...": "other page properties"
}  

Sample Response Data

  {
    "result": "success",
    "blocks": {
        "main": {
            "api": {
                "page": {
                    "id": 123,
                    "content": "sample"
                },
                "config": {
                    "name": "Blog",
                    "banner": []
                }
            },
            "html": {
                "show_author": 0
            },
            "template": {
                "file": "blog_page"
            }
        },
        "top": {
            "menu": [
                {
                    "name": "Blog Custom Menu",
                    "slug": "\/category\/blog_add",
                    "children": {
                        "19": {
                            "type": "Page",
                            "name": "New Blog",
                            "slug": "\/new-custom-post"
                        },
                        "31": {
                            "type": "Page::Collection",
                            "name": "News",
                            "slug": "\/category\/news-category"
                        }
                    }
                }
            ]
        },
        "footer": {
            "output": "Extra footer content"
        }
    }
}  

API Authentication

If your API requires authentication, you should provide each Site with an API token and design your app to have a Per Site config field to store it. Each API call include a JSON input named "json" containing the API token under json->site_config->app. Your API should capture this input and validate it. If you wish to use HTTP Headers for authentication, you may use config fields starting with Header__ (e.g: Header__Authorization will send header Authorization) to send headers to your API endpoint.