Developers

Pages

Summary of page endpoints

Related endpoints:

List all available pages for the current site

GET /admin/api/pages

Example response:

Status: 200 OK
[
  {
    "id": 1,
    "title": "Home Page",
    "slug": null,
    "path": "",
    "content_type": "page",
    "keywords": null,
    "description": null,
    "data": {},
    "root": true,
    "hidden": false,
    "publishing": true,
    "isprivate": false,
    "created_at": "2013-12-13T09:19:04.000Z",
    "updated_at": "2013-12-13T09:19:04.000Z",
    "published_at": "2013-12-13T09:19:04.000Z",
    "url": "http://helloworld.voog.co/admin/api/pages/1",
    "public_url": "http://helloworld.voog.co/",
    "contents_url": "http://helloworld.voog.co/admin/api/pages/1/contents",
    "children_url": "http://helloworld.voog.co/admin/api/pages?parent_id=1",
    "language": {
      "id": 1,
      "code": "en",
      "title": "ENG",
      "created_at": "2013-04-05T13:53:00.000Z",
      "updated_at": "2013-04-11T10:08:54.000Z",
      "url": "http://helloworld.voog.co/admin/api/languages/1"
    },
    "layout": {
      "id": 1,
      "title": "Front page",
      "layout_name": "page_front",
      "content_type": "page",
      "url": "http://helloworld.voog.co/admin/api/layouts/1",
      "created_at": "2013-04-05T13:53:00.000Z",
      "updated_at": "2013-04-11T10:08:54.000Z",
      "mime_type": "application/vnd.voog.design.custom+liquid"
    },
    "node": {
      "id": 1,
      "parent_id": null,
      "title": "Home Page",
      "position": 1,
      "created_at": "2013-12-13T09:19:04.000Z",
      "updated_at": "2013-12-13T09:19:04.000Z",
      "url": "http://helloworld.voog.co/admin/api/nodes/1",
      "children_url": "http://helloworld.voog.co/admin/api/nodes?parent_id=1",
      "parent_url": null
    }
  }, {
    "id": 2,
    "title": "Products",
    "slug": "products",
    "path": "products",
    "content_type": "page",
    "keywords": null,
    "description": null,
    "data": {
      "my_key_1": "Value 1",
      "my_key_2": 2
    },
    "root": false,
    "hidden": false,
    "publishing": true,
    "isprivate": false,
    "permanent_redirect_url": "http://helloworld.voog.co/our-products",
    "created_at": "2013-12-13T09:19:04.000Z",
    "updated_at": "2014-01-03T12:14:34.000Z",
    "published_at": "2013-12-13T09:19:04.000Z",
    "url": "http://helloworld.voog.co/admin/api/pages/2",
    "public_url": "http://helloworld.voog.co/products",
    "contents_url": "http://helloworld.voog.co/admin/api/pages/2/contents",
    "children_url": "http://helloworld.voog.co/admin/api/pages?parent_id=2",
    "language": {
      "id": 1,
      "code": "en",
      "title": "ENG",
      "created_at": "2013-04-05T13:54:32.000Z",
      "updated_at": "2013-04-11T10:09:51.000Z",
      "url": "http://helloworld.voog.co/admin/api/languages/1"
    },
    "layout": {
      "id": 2,
      "title": "Common page",
      "layout_name": "page_default",
      "content_type": "page",
      "url": "http://helloworld.voog.co/admin/api/layouts/2",
      "created_at": "2013-04-05T13:54:32.000Z",
      "updated_at": "2013-04-11T10:09:51.000Z",
      "mime_type": "application/vnd.voog.design.custom+liquid"
    },
    "node": {
      "id": 2,
      "parent_id": 1,
      "title": "Products",
      "position": 2,
      "created_at": "2013-12-13T09:19:04.000Z",
      "updated_at": "2014-01-03T12:14:34.000Z",
      "url": "http://helloworld.voog.co/admin/api/nodes/2",
      "children_url": "http://helloworld.voog.co/admin/api/nodes?parent_id=2",
      "parent_url": "http://helloworld.voog.co/admin/api/nodes/1"
    }
  }
]

Parameters

  • per_page - elements per response (default: 50; maximum: 250).
  • page - requested page (default: 1).
  • parent_id - parent page id (e.g. ?parent_id=1). Returns only children pages for requested parent page.
  • node_id - page node id (e.g. ?node_id=1). Returns only pages for requested node.
  • language_id - language id (e.g. ?language_id=1). Returns only pages for requested language.
  • language_code - language code (e.g. ?language_code=en). Returns only pages with requested language code.
  • path - path (e.g. ?path=products/books). Returns only page with requested path.
  • path_prefix - path prefix (e.g. ?path_prefix=products/). Returns only those pages whose path begins with the given prefix.
  • content_type - page type (e.g. ?content_type=blog). Accepted values are page, blog, elements and link.

Filter attributes

Read more about filters.

  • Object page attributes: id, language_id, node_id, layout_id, title, path, content_type, keywords, description, hidden, publishing, privacy, created_at, updated_at, published_at.
  • Object language attributes: id, code, title, position, default_language, created_at, updated_at.
  • Object node attributes: id, parent_id, title, position, created_at, updated_at.

Create a new page for the current site

POST /admin/api/pages

Example data:

{
  "title": "Contacts",
  "slug": "contacts",
  "layout_id": 2,
  "parent_id": 1
}

Example response:

Status: 201 Created
{
  "id": 3,
  "title": "Contacts",
  "slug": "contacts",
  "path": "contacts",
  "content_type": "page",
  "keywords": null,
  "description": null,
  "data": {},
  "root": false,
  "hidden": false,
  "publishing": true,
  "isprivate": false,
  "created_at": "2014-01-10T09:19:04.000Z",
  "updated_at": "2014-01-10T09:19:04.000Z",
  "published_at": "2014-01-10T09:19:04.000Z",
  "url": "http://helloworld.voog.co/admin/api/pages/3",
  "public_url": "http://helloworld.voog.co/contacts",
  "contents_url": "http://helloworld.voog.co/admin/api/pages/3/contents",
  "children_url": "http://helloworld.voog.co/admin/api/pages/3?parent_id=3",
  "language": {
    "id": 1,
    "code": "en",
    "title": "ENG",
    "created_at": "2013-04-05T13:54:32.000Z",
    "updated_at": "2013-04-11T10:09:51.000Z",
    "url": "http://helloworld.voog.co/admin/api/languages/1"
  },
  "layout": {
    "id": 2,
    "title": "Common page",
    "layout_name": "page_default",
    "content_type": "page",
    "url": "http://helloworld.voog.co/admin/api/layouts/2",
    "created_at": "2013-04-05T13:54:32.000Z",
    "updated_at": "2013-04-11T10:09:51.000Z",
    "mime_type": "application/vnd.voog.design.custom+liquid"
  },
  "node": {
    "id": 3,
    "parent_id": 1,
    "title": "Contacts",
    "position": 3,
    "created_at": "2014-01-10T09:19:04.000Z",
    "updated_at": "2014-01-10T09:19:04.000Z",
    "url": "http://helloworld.voog.co/admin/api/nodes/3",
    "children_url": "http://helloworld.voog.co/admin/api/nodes?parent_id=3",
    "parent_url": "http://helloworld.voog.co/admin/api/nodes/1"
  }
}

Parameters

  • title - page title in menu.
  • layout_id - page layout id.
  • slug - page url part in current folder. Value '' means the root page. Slug is unique in given subfolder. If not set then title value is used to generate it.
  • parent_id - parent page id.
  • node_id - related node id.
  • language_id - language id. Creates new page under
  • content_type - page's content type (used only when creating a link)
  • path - URL the link points to (used only when creating a link)
  • description - page meta description.
  • image_id - id of the page descriptive image (commonly used for OG tags) - should be id of asset with image type (default: null).
  • hidden - hidden in site menu. (Default: false).
  • publishing - publish changes automatically. If turned on then every page (or page content) update is published automatically. (Default: true).
  • privacy - enable or disable password protection for page and it's sub pages (default: false).
  • data - key/value based custom hash store. (NB! Keys with prefixes internal_ are protected and read only.)
  • permanent_redirect_url - fully qualified url. If set then current page returns (301 redirect response)[http://en.wikipedia.org/wiki/HTTP_301] to it (default: null). Example: http://www.mysite.com/some_subpage.
  • keywords [deprecated] - page meta keywords.
Minimum required parameters when creating a page object

New subpage:

parent_id - creates a new page under the given parent page. Creates a new node and uses parent page's language.

Translation of existing page:

parent_id and node_id - creates a new page under the given parent page, bound to an existing node. Uses the parent page's language.

or

language_id and node_id - creates a new page for the given language, bound to the given node. (NB! parent page should already be created for the given language.)

Additional required parameters when creating a page
  • title - page title in menu
  • layout_id - page layout id
Addditional required parameters when creating a link
  • title - link title in menu
  • content_type - specifies the page as a link. Only valid value is link.
  • path - URL the link points to
URL format

For full URLs, the protocol is mandatory. Allowed protocols are "http" and "https". HTTP query parameters are also supported.

Examples:

  • http://example.com/page?parameter=value&also=another
  • https://www.google.com/search?q=test
  • /products (initial slash is mandatory for relative paths)
  • //subpage (double slash uses site's current protocol)

Get data for a single page

GET /admin/api/pages/1

Example request:

GET http://helloworld.voog.co/admin/api/pages/2

Example response:

Status: 200 OK
{
  "id": 2,
  "title": "Products",
  "slug": "products",
  "path": "products",
  "content_type": "page",
  "keywords": null,
  "description": null,
  "data": {
    "my_key_1": "Value 1",
    "my_key_2": 2
  },
  "root": false,
  "hidden": false,
  "publishing": true,
  "isprivate": false,
  "created_at": "2013-12-13T09:19:04.000Z",
  "updated_at": "2014-01-03T12:14:34.000Z",
  "published_at": "2013-12-13T09:19:04.000Z",
  "url": "http://helloworld.voog.co/admin/api/pages/2",
  "public_url": "http://helloworld.voog.co/products",
  "contents_url": "http://helloworld.voog.co/admin/api/pages/2/contents",
  "children_url": "http://helloworld.voog.co/admin/api/pages?parent_id=2",
  "language": {
    "id": 1,
    "code": "en",
    "title": "ENG",
    "created_at": "2013-04-05T13:54:32.000Z",
    "updated_at": "2013-04-11T10:09:51.000Z",
    "url": "http://helloworld.voog.co/admin/api/languages/1"
  },
  "layout": {
    "id": 2,
    "title": "Common page",
    "layout_name": "page_default",
    "content_type": "page",
    "url": "http://helloworld.voog.co/admin/api/layouts/2",
    "created_at": "2013-04-05T13:54:32.000Z",
    "updated_at": "2013-04-11T10:09:51.000Z",
    "mime_type": "application/vnd.voog.design.custom+liquid"
  },
  "node": {
    "id": 2,
    "parent_id": 1,
    "title": "Products",
    "position": 2,
    "created_at": "2013-12-13T09:19:04.000Z",
    "updated_at": "2014-01-03T12:14:34.000Z",
    "url": "http://helloworld.voog.co/admin/api/nodes/2",
    "children_url": "http://helloworld.voog.co/admin/api/nodes?parent_id=2",
    "parent_url": "http://helloworld.voog.co/admin/api/nodes/1"
  },
  "image": {
    "id": 1,
    "content_type": "image/jpeg",
    "width": 1024,
    "height": 768,
    "url": "http://helloworld.voog.co/admin/api/assets/1",
    "public_url": "http://media.voog.com/0000/0000/0001/photos/Chrysanthemum.jpg",
    "sizes": [
      {
        "content_type": "image/jpeg",
        "width": 600,
        "height": 450,
        "url": "http://media.voog.com/0000/0000/0001/photos/Chrysanthemum_block.jpg"
      },
      {
        "content_type": "image/jpeg",
        "width": 1024,
        "height": 768,
        "url": "http://media.voog.com/0000/0000/0001/photos/Chrysanthemum.jpg"
      }
    ]
  },
  "contents": [
    {
      "id": 4,
      "name": "body",
      "position": 1,
      "content_type": "text",
      "url": "http://helloworld.voog.co/admin/api/pages/2/contents/4",
      "created_at": "2013-12-13T09:19:05.000Z",
      "updated_at": "2013-12-13T09:19:05.000Z"
    },
    {
      "id": 5,
      "name": "slogan",
      "position": 1,
      "content_type": "text",
      "url": "http://helloworld.voog.co/admin/api/pages/2/contents/5",
      "created_at": "2013-12-13T09:19:05.000Z",
      "updated_at": "2013-12-13T09:19:05.000Z"
    }
  ]
}

The output may depend of page content_type.

For "content_type="blog"" there are additional attributes:

{
  "...": "...",
  "articles_url": "http://helloworld.voog.co/admin/api/articles?page_id=4
  "...": "..."
}

For "content_type="elements"" there are additional attributes:

{
  "...": "...",
  "elements_url": "http://helloworld.voog.co/admin/api/elements?page_id=4
  "...": "..."
}

Parameters

  • include_children - includes list of subpages to response. (Eg ?include_children=true)

Update attributes of a page

PUT /admin/api/pages/1

This request updates the page with provided attributes. It replaces data attribute with new key set if data attribute is present in request.

PATCH /admin/api/pages/1

This request updates the page with provided attributes. It merges provided keys to data attribute if data attribute is present in request.

Example request:

PUT http://helloworld.voog.co/admin/api/pages/3

Example data:

{
  "title": "About",
  "slug": "about",
  "description": "We are a small crew of designers and developers passionate about usability.",
  "data": {
    "key_1": "value_1",
    "key_2": "value_2"
  }
}

Example response:

Status: 200 OK
{
  "id": 3,
  "title": "About",
  "slug": "about",
  "path": "about",
  "content_type": "page",
  "keywords": null,
  "description": "We are a small crew of designers and developers passionate about usability.",
  "data" : {
    "key_1": "value_1",
    "key_2": "value_2"
  },
  "root": false,
  "hidden": false,
  "publishing": true,
  "isprivate": false,
  "created_at": "2014-01-10T09:19:04.000Z",
  "updated_at": "2014-01-10T10:10:10.000Z",
  "published_at": "2014-01-10T10:10:10.000Z",
  "url": "http://helloworld.voog.co/admin/api/pages/3",
  "public_url": "http://helloworld.voog.co/contacts",
  "contents_url": "http://helloworld.voog.co/admin/api/pages/3/contents",
  "children_url": "http://helloworld.voog.co/admin/api/pages?parent_id=3",
  "language": {
    "id": 1,
    "code": "en",
    "title": "ENG",
    "created_at": "2013-04-05T13:54:32.000Z",
    "updated_at": "2013-04-11T10:09:51.000Z",
    "url": "http://helloworld.voog.co/admin/api/languages/1"
  },
  "layout": {
    "id": 2,
    "title": "Common page",
    "layout_name": "page_default",
    "content_type": "page",
    "url": "http://helloworld.voog.co/admin/api/layouts/2",
    "created_at": "2013-04-05T13:54:32.000Z",
    "updated_at": "2013-04-11T10:09:51.000Z",
    "mime_type": "application/vnd.voog.design.custom+liquid"
  },
  "node": {
    "id": 3,
    "parent_id": 1,
    "title": "Contacts",
    "position": 3,
    "created_at": "2014-01-10T09:19:04.000Z",
    "updated_at": "2014-01-10T09:19:04.000Z",
    "url": "http://helloworld.voog.co/admin/api/nodes/3",
    "children_url": "http://helloworld.voog.co/admin/api/nodes?parent_id=3",
    "parent_url": "http://helloworld.voog.co/admin/api/nodes/1"
  }
}

Parameters

Optional parameters:

  • title - page title in menu.
  • slug - page url part in current folder.
  • layout_id - page layout id.
  • description - page meta description.
  • image_id - id of the page descriptive image (commonly used for OG tags) - should be id of asset with image type (default: null).
  • hidden - hidden in site menu.
  • publishing - publish changes automatically.
  • privacy - enable or disable password protection for page and it's sub pages.
  • data - key/value based custom hash store. If attribute data is present in request then new value replaces existing data value. (NB! Keys with prefixes internal_ are protected and read only.)
  • permanent_redirect_url - fully qualified url. If set then current page returns (301 redirect response)[http://en.wikipedia.org/wiki/HTTP_301] to it (default: null). Example: http://www.mysite.com/some_subpage.
  • keywords [deprecated] - page meta keywords.

Remove a page

DELETE /admin/api/pages/3

This request deletes the layout from the database.

Example request:

DELETE http://helloworld.voog.co/admin/api/pages/3

Example response:

Status: 204 No Content

Limits:

  • If page has at least one subpage, it will not be deleted.

Update custom data field of a page

PUT /admin/api/pages/1/data/key

Updates or adds a new key to page data keyset.

Example request:

PUT http://helloworld.voog.co/admin/api/pages/2/data/my_key_1

Example data:

{
  "value": "new value"
}

Example response:

Status: 200 OK
{
  "id": 2,
  "title": "Products",
  "slug": "products",
  "path": "products",
  "content_type": "page",
  "keywords": null,
  "description": null,
  "data": {
    "my_key_1": "new value",
    "my_key_2": "value_2"
  },
  "root": false,
  "hidden": false,
  "publishing": true,
  "isprivate": false,
  "created_at": "2013-12-13T09:19:04.000Z",
  "updated_at": "2014-01-10T12:14:34.000Z",
  "published_at": "2014-01-10T09:19:04.000Z",
  "url": "http://helloworld.voog.co/admin/api/pages/2",
  "public_url": "http://helloworld.voog.co/products",
  "contents_url": "http://helloworld.voog.co/admin/api/pages/2/contents",
  "children_url": "http://helloworld.voog.co/admin/api/pages?parent_id=2",
  "language": {
    "id": 1,
    "code": "en",
    "title": "ENG",
    "created_at": "2013-04-05T13:54:32.000Z",
    "updated_at": "2013-04-11T10:09:51.000Z",
    "url": "http://helloworld.voog.co/admin/api/languages/1"
  },
  "layout": {
    "id": 2,
    "title": "Common page",
    "layout_name": "page_default",
    "content_type": "page",
    "url": "http://helloworld.voog.co/admin/api/layouts/2",
    "created_at": "2013-04-05T13:54:32.000Z",
    "updated_at": "2013-04-11T10:09:51.000Z",
    "mime_type": "application/vnd.voog.design.custom+liquid"
  },
  "node": {
    "id": 2,
    "parent_id": 1,
    "title": "Products",
    "position": 2,
    "created_at": "2013-12-13T09:19:04.000Z",
    "updated_at": "2014-01-03T12:14:34.000Z",
    "url": "http://helloworld.voog.co/admin/api/nodes/2",
    "children_url": "http://helloworld.voog.co/admin/api/nodes?parent_id=2",
    "parent_url": "http://helloworld.voog.co/admin/api/nodes/1"
  }
}

Remove custom field of a page

DELETE /admin/api/pages/1/data/key

Example request:

DELETE http://helloworld.voog.co/admin/api/pages/2/data/my_key_1

Example response:

Status: 204 No Content