API Reference

Layouts

Layouts and the areas they expose. A layout is hidden rather than deleted.

Prefix /cdna-api/common ReferenceLayout model GuideLayouts and areas
Layouts in Postman

List layouts#

GET /cdna-api/common/layouts

Lists layouts. Without limit every match comes back.

Access
Admin users and integrations, with an OAuth access token or an API key.
Model
Layout, in the Reference

Parameters

propertiesquery
selector
The fields and relations to return, such as {id,name,template}.
filtersquery
name=value
Any stored field, or a relation with a dot, such as parent.id=12. Prefix the name with !, >, <, % or |. Use stored field names exactly as in the model, and compare totalCount with the unfiltered list's to confirm a filter applied.
orderByquery
string
field:ASC or field:DESC, comma-separated. Stored fields only.
limitquery
integer
Records per response. There is no default.
offsetquery
integer
Records to skip.

Example

List layouts
GET /cdna-api/common/layouts?limit=2&properties={id,name,template} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Response 200 OK
{
  "result": "success",
  "totalCount": 84,
  "data": [
    {
      "id": 1,
      "name": "Default layout",
      "template": "blogs/posts/show.html"
    },
    {
      "id": 2,
      "name": "Default layout",
      "template": "pages/pages/show.html"
    }
  ]
}
Open in Postman docs Real response from this documentation site

Show a layout#

GET /cdna-api/common/layout/{id}

Reads one layout by its id.

Access
Admin users and integrations, with an OAuth access token or an API key.
Model
Layout, in the Reference

Parameters

idpathrequired
integer
The layout id.
propertiesquery
selector
The fields and relations to return, such as {id,name,template}.

Example

Show a layout
GET /cdna-api/common/layout/92?properties={id,name,template} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Response 200 OK
{
  "result": "success",
  "data": {
    "id": 92,
    "name": "Hub API Reference",
    "template": "pages/pages/hub-api-reference.html"
  }
}
Open in Postman docs Real response from this documentation site

Create a layout#

POST /cdna-api/common/layout

Creates a layout.

Access
Admin users and integrations, with an OAuth access token or an API key.

Parameters

namebody
string
The name.
templatebody
string
The template path, relative to the site’s templates folder.
controllerbody
string
The frontend controller class the layout renders for.
areasbody
list
The layout’s areas, each with name, label and type (an input type id). An existing area is kept by sending its id; one left out of the list is deleted with its content.

Example

Create a layout
POST /cdna-api/common/layout HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json

{
  "name": "New layout from API",
  "template": "books/pages/show.html",
  "controller": "Books\\Controllers\\Frontend\\Pages\\Show",
  "areas": [
    {
      "name": "headline",
      "type": 1,
      "label": "Page headline (can be ommitted)",
      "default": "Default text (can be ommitted)"
    },
    {
      "name": "left area (collection)",
      "type": 13,
      "label": "Left content"
    },
    {
      "name": "right area (collection)",
      "type": 13,
      "label": "Right content"
    }
  ]
}
Response 200 OK
{
  "result": "success",
  "data": {
    "layout": {
      "id": 56,
      "controller": "Books\\Controllers\\Frontend\\Pages\\Show",
      "template": "books/pages/show.html",
      "name": "New layout from API",
      "text": null,
      "created": "2020-03-23T12:55:30+00:00",
      "modified": "2020-03-23T12:55:30+00:00",
      "hidden": null,
      "areas": [
        249,
        250
      ],
      "image": null
    }
  },
  "message": "The Layout has been added successfully."
}
Open in Postman docs Saved response from the Postman collection, shortened

Edit a layout#

PUT /cdna-api/common/layout/{id}

Changes a layout. Fields left out keep their values.

Access
Admin users and integrations, with an OAuth access token or an API key.

Parameters

idpathrequired
integer
The layout id.
namebody
string
The name.
templatebody
string
The template path, relative to the site’s templates folder.
controllerbody
string
The frontend controller class the layout renders for.
areasbody
list
The layout’s areas, each with name, label and type (an input type id). An existing area is kept by sending its id; one left out of the list is deleted with its content.

Example

Edit a layout
PUT /cdna-api/common/layout/56 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json

{
  "name": "Layout from API",
  "template": "books/pages/show.html",
  "controller": "Books\\Controllers\\Frontend\\Pages\\Show",
  "areas": [
    {
      "id": 249
    },
    {
      "id": 250,
      "hidden": "2020-03-23 10:00:00"
    },
    {
      "id": 251,
      "hidden": "2020-03-23 10:00:00"
    },
    {
      "name": "main area",
      "label": "Main area (collection)",
      "type": 13
    }
  ]
}
Response 200 OK
{
  "result": "success",
  "data": {
    "layout": {
      "id": 56,
      "controller": "Books\\Controllers\\Frontend\\Pages\\Show",
      "template": "books/pages/show.html",
      "name": "Layout from API",
      "text": null,
      "created": "2020-03-23T12:55:30+00:00",
      "modified": "2020-03-23T13:09:33+00:00",
      "hidden": null,
      "areas": [
        249,
        250
      ],
      "image": null
    }
  },
  "message": "The Layout has been saved successfully."
}
Open in Postman docs Saved response from the Postman collection, shortened

Hide a layout#

PUT /cdna-api/common/layout/{id}

Hides a layout from editors’ choices. A layout is hidden rather than deleted, because deleting it would also remove the content of every area that uses it.

Access
Admin users and integrations, with an OAuth access token or an API key.

Parameters

idpathrequired
integer
The layout id.
hiddenbody
boolean
true hides it from editors’ choices.

Example

Hide a layout
PUT /cdna-api/common/layout/56 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json

{
  "hidden": true
}
Response 200 OK
{
  "result": "success",
  "data": {
    "layout": {
      "id": 56,
      "controller": "Books\\Controllers\\Frontend\\Pages\\Show",
      "template": "books/pages/show.html",
      "name": "Layout from API",
      "text": null,
      "created": "2020-03-23T12:55:30+00:00",
      "modified": "2020-03-23T13:12:30+00:00",
      "hidden": "2020-03-23T13:12:30+00:00",
      "areas": [
        249,
        250
      ],
      "image": null
    }
  },
  "message": "The Layout has been saved successfully."
}
Open in Postman docs Saved response from the Postman collection, shortened