Voog.com

Nodes

Summary of node endpoints

List all available nodes for the current site

GET /admin/api/nodes

Example response:

Status: 200 OK
[
  {
    "id": 1,
    "title": "Home Page",
    "parent_id": null,
    "position": 1,
    "created_at": "2014-01-24T09:19:04.000Z",
    "updated_at": "2014-01-24T09: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",
    "parent_id": 1,
    "position": 2,
    "created_at": "2014-01-24T09:19:04.000Z",
    "updated_at": "2014-01-24T09:19:04.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 node id (eg 1). Returns only children nodes for requested parent node.

Filter attributes

Read more about filters.

  • Object node attributes: id, parent_id, title, position, created_at, updated_at.

Get data for a single node

GET /admin/api/nodes/1

Example request:

GET http://helloworld.voog.co/admin/api/nodes/1?include_children=true

Example response:

Status: 200 OK
{
  "id": 1,
  "title": "Home Page",
  "parent_id": null,
  "position": 1,
  "created_at": "2014-01-24T09:19:04.000Z",
  "updated_at": "2014-01-24T09: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,
  "children": [{
    "id": 2,
    "title": "Products",
    "parent_id": 1,
    "position": 2,
    "created_at": "2014-01-24T09:19:04.000Z",
    "updated_at": "2014-01-24T09:19:04.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

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

Update attributes of a node

PUT /admin/api/nodes/1

Example request:

PUT http://helloworld.voog.co/admin/api/nodes/2

Example data:

{
  "title": "New Products"
}

Example response:

Status: 200 OK
{
  "id": 2,
  "title": "New Products",
  "parent_id": 1,
  "position": 2,
  "created_at": "2014-01-24T09:19:04.000Z",
  "updated_at": "2014-01-24T11:22:04.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

Optional parameters:

  • title - node title show in menu when node is "untranslated" in selected language.

Relocate a node

PUT /admin/api/nodes/1/move

Reorders or moves node around nodes list.

Example request:

PUT http://helloworld.voog.co/admin/api/nodes/3/move?parent_id=2

Example response:

Status: 200 OK
{
  "id": 3,
  "title": "3rd page (node)",
  "parent_id": 2,
  "position": 1,
  "created_at": "2014-01-24T11:25:04.000Z",
  "updated_at": "2014-01-24T11:27:11.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/2"
}

Parameters

Required parameters:

  • parent_id - current or new parent node id under which current node is reordered or moved (e.g. ?parent_id=2).

Optional parameters:

  • position - new position for the current node under new parent. Value is starting form 1 and default value is 1 (e.g. ?parent_id=2&position=1).