Voog.com

Media sets

Media sets are collections of assets. It may be a part of content (gallery) or separate set without parent.

Summary of media set endpoints

List all available media sets for the current site

GET /admin/api/media_sets

Example response:

Status: 200 OK
[
  {
    "id": 1,
    "title": "",
    "kind": "squares",
    "settings": {},
    "created_at": "2014-01-16T08:04:27.000Z",
    "updated_at": "2014-01-16T08:04:27.000Z",
    "url": "http://helloworld.voog.co/admin/api/media_sets/1",
    "add_assets_url": "http://helloworld.voog.co/admin/api/media_sets/1/add_assets",
    "content": {
      "id": 3,
      "name": "body",
      "created_at": "2014-01-16T08:04:27.000Z",
      "updated_at": "2014-01-16T14:56:45.000Z",
      "position": 3,
      "url": "http://helloworld.voog.co/admin/api/pages/1/contents/3"
    },
    "parent": {
      "id": 1,
      "title": "Home Page",
      "created_at": "2013-12-13T09:19:04.000Z",
      "updated_at": "2013-12-13T09:19:04.000Z",
      "type": "page",
      "url": "http://helloworld.voog.co/admin/api/pages/1"
    }
  }, {
    "id": 2,
    "title": "Standalone media set",
    "kind": "squares",
    "settings": {},
    "created_at": "2014-01-16T08:16:33.000Z",
    "updated_at": "2014-01-16T08:16:33.000Z",
    "url": "http://helloworld.voog.co/admin/api/media_sets/2",
    "add_assets_url": "http://helloworld.voog.co/admin/api/media_sets/2/add_assets"
  }
]

Parameters

  • per_page - elements per response (default: 50; maximum: 250).
  • page - requested page (default: 1).
  • parent_id and parent_type - parent id and type. Returns text contents for parent. If present then both parameters are required. For media sets without parent empty values should be provided (e.g. ?parent_id=""&parent_type=""). Allowed values for parent_type are:
    • page - parent is page.
    • language parent is language.
    • article - parent is article.

Filter attributes

Read more about filters.

  • Object media_set attributes: id, title, created_at, updated_at.
  • Object content attributes: id, parent_id, language_id, content_id, content_type, page_id, page_type, name, position, created_at, updated_at.

Create a new media set for the current site

POST /admin/api/media_sets

Example data:

{
  "title": "New collection",
  "assets": [{
    "id": 1,
    "title": "Wonderful photo",
    "settings": {
      "linkurl": "http://voog.com",
      "linktarget": "_blank"
    }
  }, {
    "id": 7
  }]
}

Example response:

Status: 201 Created
{
  "id": 3,
  "title": "New collection",
  "kind": "squares",
  "settings": {},
  "created_at": "2014-01-16T09:22:33.000Z",
  "updated_at": "2014-01-16T09:22:33.000Z",
  "url": "http://helloworld.voog.co/admin/api/media_sets/3",
  "add_assets_url": "http://helloworld.voog.co/admin/api/media_sets/3/add_assets"
}

Parameters

Optional parameters:

  • title - label for media set shown in admin interface (default: "").
  • assets - ordered array of assets to be added to new media set (default: []). E.g [{"id": 1, "title": "Label in gallery"}]. Parameters for added assets are:
    • id - id of existing asset (required).
    • title - label (gallery description) for asset object (default: "").
    • settings - mediaset asset settings represent as hash. Supported keys:
    • linkurl - if set, gallery showing the media_set will navigate to link when clicking on thumb, instead of opening lightbox.
    • linktarget - if linkurl is set determines the link's target attribute method. Default is _self.
  • kind - kind of the media set. Supported values are: grid, slider, squares and wall (default: squares).
  • settings - kind depend media set settings represent as hash (e. g. {"thumbsize": 150}). Supported keys by kind:
    • grid - columns, spacing (e. g. {"columns": 4, "spacing": 0}).
    • slider - height, interval (e. g. {"interval": 0, "height": 300}).
    • squares - thumbsize (e. g. {"thumbsize": 96}).
    • wall - spacing, thumbsize (e. g. {"thumbsize": 200, spacing: 0}).

Get data for a single media set

GET /admin/api/media_sets/1

Example request:

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

Example response:

Status: 200 OK
{
  "id": 1,
  "title": "",
  "kind": "squares",
  "settings": {},
  "created_at": "2014-01-16T08:04:27.000Z",
  "updated_at": "2014-01-16T08:11:23.000Z",
  "url": "http://helloworld.voog.co/admin/api/media_sets/1",
  "add_assets_url": "http://helloworld.voog.co/admin/api/media_sets/1/add_assets",
  "assets": [{
    "title": "",
    "position": 1,
    "created_at": "2014-01-16T08:02:27.000Z",
    "updated_at": "2014-01-16T08:02:27.000Z",
    "settings": {
      "linkurl": "http://voog.com",
      "linktarget": "_blank"
    },
    "id": 1,
    "filename": "account-currency.png",
    "content_type": "image/png",
    "status": "done",
    "size": 111076,
    "extension": "png",
    "type": "image",
    "width": 634,
    "height": 295,
    "url": "http://helloworld.voog.co/admin/api/assets/1",
    "original_url": "http://media.voog.com/0000/0000/0001/photos/account-currency.png",
    "sizes": [
      {
        "thumbnail": "block",
        "filename": "account-currency_block.png",
        "content_type": "image/png",
        "size": 77138,
        "width": 500,
        "height": 233,
        "original_url": "http://media.voog.com/0000/0000/0001/photos/account-currency_block.png"
      },
      {
        "thumbnail": "medium",
        "filename": "account-currency_medium.jpg",
        "content_type": "image/jpeg",
        "size": 3680,
        "width": 150,
        "height": 70,
        "original_url": "http://media.voog.com/0000/0000/0001/photos/account-currency_medium.jpg"
      }
    ]
  }, {
    "title": "",
    "position": 2,
    "created_at": "2014-01-16T08:02:44.000Z",
    "updated_at": "2014-01-16T08:02:44.000Z",
    "id": 2,
    "filename": "daily-recap-files.png",
    "content_type": "image/png",
    "size": 124076,
    "extension": "png",
    "type": "image",
    "status": "done",
    "width": 706,
    "height": 651,
    "url": "http://helloworld.voog.co/admin/api/assets/2",
    "original_url": "http://media.voog.com/0000/0000/0001/photos/daily-recap-files.png",
    "sizes": [
      {
        "filename": "daily-recap-files_block.png",
        "content_type": "image/png",
        "size": 98135,
        "thumbnail": "block",
        "width": 500,
        "height": 461,
        "original_url": "http://media.voog.com/0000/0000/0001/photos/daily-recap-files_block.png"
      },
      {
        "filename": "daily-recap-files-1_medium.jpg",
        "content_type": "image/jpeg",
        "size": 4880,
        "thumbnail": "medium",
        "width": 150,
        "height": 138,
        "original_url": "http://media.voog.com/0000/0000/0001/photos/daily-recap-files_medium.jpg"
      }
    ]
  }],
  "content": {
    "id": 3,
    "name": "body",
    "created_at": "2014-01-16T08:04:27.000Z",
    "updated_at": "2014-01-16T14:56:45.000Z",
    "position": 3,
    "url": "http://helloworld.voog.co/admin/api/pages/1/contents/3"
  },
  "parent": {
    "id": 1,
    "title": "Home Page",
    "created_at": "2013-12-13T09:19:04.000Z",
    "updated_at": "2013-12-13T09:19:04.000Z",
    "type": "page",
    "url": "http://helloworld.voog.co/admin/api/pages/1"
  }
}

Update attributes of a single media set

PUT /admin/api/media_sets/1

This request updates the media set with provided attributes.

Example request:

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

Example data:

{
  "title": "Updated collection",
  "kind": "wall",
  "assets": [{
    "id": 2,
    "title": "It now first photo in this set.",
    "settings": {
      "linkurl": "http://voog.com",
      "linktarget": "_blank"
    }
  }, {
    "id": 7,
    "title": ""
  }, {
    "id": 1,
    "title": "Wonderful photo"
  }]
}

Example response:

Status: 200 OK
{
  "id": 3,
  "title": "Updated collection",
  "kind": "wall",
  "settings": {},
  "created_at": "2014-01-16T09:22:33.000Z",
  "updated_at": "2014-01-16T10:20:11.000Z",
  "url": "http://helloworld.voog.co/admin/api/media_sets/3",
  "add_assets_url": "http://helloworld.voog.co/admin/api/media_sets/3/add_assets"
}

Parameters

Optional parameters:

  • title - label for media set shown in admin interface.
  • assets - ordered array of assets that re. If provided in request then replaces the asset set with new one. E.g [{"id": 1, "title": "Label in gallery"}]. Parameters for assets are:
    • id - id of existing asset (required).
    • title - label (gallery description) for asset object (default: "").
    • settings - mediaset asset settings represent as hash. Supported keys:
    • linkurl - if set, gallery showing the media_set will navigate to link when clicking on thumb, instead of opening lightbox.
    • linktarget - if linkurl is set determines the link's target attribute method. Default is _self.

Add assets to media set

POST /admin/api/media_sets/1/add_assets

This request adds assets with provided ids to end of the media set.

Example request:

POST http://helloworld.voog.co/admin/api/media_sets/3/add_assets

Example data:

{
  "asset_ids": [1, 2, 3, 5, 8, 13]
}

Example response:

Status: 200 OK
{
  "id": 3,
  "title": "Updated collection",
  "kind": "squares",
  "settings": {},
  "created_at": "2014-01-16T09:22:33.000Z",
  "updated_at": "2014-01-16T11:01:01.000Z",
  "url": "http://helloworld.voog.co/admin/api/media_sets/3",
  "add_assets_url": "http://helloworld.voog.co/admin/api/media_sets/3/add_assets"
}

Parameters

Required parameters:

  • asset_ids - array of asset ids that should be append to the media set (e.g. [8, 17]).

Remove a media set

DELETE /admin/api/media_sets/1

This request deletes the media set from the database. NB! Only media sets without related content can be deleted. Use Contents API to delete media set with related content.

Example request:

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

Example response:

Status: 204 No Content