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.
- /components/[component name]/ — default data format (JSON + rendered markup)
- /components/[component name]/json/ — data contains only JSON
- /components/[component name]/rendered/ — data contains onlyh rendered markup
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.
- /pages/[page ID]/ — default data format (JSON + rendered markup)
- /pages/[page ID]/json/ — data contains only JSON
- /pages/[page ID]/rendered/ — data contains onlyh rendered markup
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.
- /partials/[partial name]/
- /partials/[directory name]/[subdirectory name]/[partial name]/
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>"
}
}