Available API endpoints

Out of the box Wireframe API provides endpoints for components, pages, and partials. Keep in mind, though, that none of these are enabled by default — you need to enable the endpoints that you need via module configuration settings.

Components

Components endpoint returns data for a single component. By default the endpoint returns JSON values and the rendered markup for the component, but you can specifically request only JSON or rendered output.

Note: in order to get JSON value from the API for a Component, you need to implement the renderJSON() method for your Component. See Component base class for more details.

Example return value

curl https://www.yoursite.tld/wireframe-api/components/Card/
{
    "success": true,
    "message": "",
    "path": "wireframe-api\/components\/Card",
    "args": [],
    "data": {
        "json": {
            "title": "Wireframe API",
            "text": "Provides a JSON API for accessing Wireframe's features",
        },
        "rendered": "<div class=\"card\"><h2>Wireframe API<\/h2><p>Provides a JSON API for accessing Wireframe's features<\/p><\/div>"
    }
}

Pages

Pages endpoint returns data for a single page. By default the endpoint returns JSON values and the rendered markup for the page, but you can request only JSON or rendered output.

Note: in order to get JSON value from the API for a Page, you need to implement the renderJSON() method for the applicable Controller. See Controller base class for more details.

Example return value

curl https://www.yoursite.tld/wireframe-api/pages/1/
{
    "success": true,
    "message": "",
    "path": "wireframe-api\/components\/Card",
    "args": [],
    "data": {
        "json": {
            "title": "Home page",
            "body": "<p>Home page body field.<\/p>",
        },
        "rendered": "<html><h1>Home page<\/h1><p>Home page body field.<\/p><\/html>"
    }
}

Partials

Partials endpoint returns data for a single partial. For this endpoint the returned data always contains rendered value (partials don't have a way to return JSON data separately). Partials can be organized into directories, and the partials endpoint also supports this.

Be sure to adjust the number of allowed URL segments before attempting to fetch deeply nested partials!

Example return value

curl https://www.yoursite.tld/wireframe-api/partials/menu/
{
    "success": true,
    "message": "",
    "path": "wireframe-api\/partials\/menu",
    "args": [],
    "data": {
        "rendered": "<nav><ul><li><a href=\"\/\">Home<\/a><\/li><li><a href=\"\/about-us\/\">About us<\/a><\/li><\/ul><\/nav>"
    }
}
Back to top