Table of contents

Compilations API

The Compilations API allows you to create curated lists of items

List compilations

GET /api/data/compilations

Returns a list of all compilations user has access to

	{
	"compilations": [
	    {
			"compilation_id": "5833031d7d551417c16891d475429de3",
			"name": "Cats and Dogs going wild",
			"num_items": 23,
			"public": true,
			"thumbnail": {
				"height": 100,
				"width": 250,
				"path": "/absolute/path/to/image.jpeg",
				"type": "image"
			},
			"created_at": "2016-11-28T00:00:00Z",
			"updated_at": "2016-11-28T14:22:58.44874Z",
			"author": {
				"user_id": "",
				"first_name": "",
				"last_name": "",
				"email": "",
				"avatar": ""
			}
	    },
	    {
			"compilation_id": "5789031d7d551417c16891d475429de3",
			"name": "Live Rock Performances",
			"num_items": 215,
			"public": false,
			"thumbnail": {
				"height": 100,
				"width": 15000,
				"path": "/absolute/path/to/image.jpeg",
				"type": "sprite"
			},
			"created_at": "2016-11-28T00:00:00Z",
			"updated_at": "2016-11-28T14:22:58.44874Z",
			"author": {
				"user_id": "",
				"first_name": "",
				"last_name": "",
				"email": "",
				"avatar": ""
			}
	    }
	]
}
  • compilation_id - (string) The ID of this compilation
  • name - (string) Human-readable name of the compilation
  • num_items - (int) number of items currently in the compilation
  • public - (false) denotes whether users besides the author view the compilation
  • thumbnail - (object) Thumbnail of the first item in the compilation (if at least one item added)
  • author_id - (string) id of the user who originally created the compilation
  • author_name - (string) first/last name of user who originally created the compilation
  • created_at - (timestamp) date/time compilation was first created
  • updated_at - (timestamp) date/time compilation was altered (items added/deleted/re-ordered, etc)

Compilation detail

Get the details for a compilation, including the list of items

GET /api/data/compilations/{id}
  • {id} - (string) The ID of the Compilation
{
	"compilation_id": "5789031d7d551417c16891d475429de3",
	"name": "Live Rock Performances",
	"num_items": 215,
	"public": true,
	"thumbnail": {
		"height": 100,
		"width": 250,
		"path": "/absolute/path/to/image.jpeg",
		"type": "image"
	},
	"created_at": "2016-11-28T00:00:00Z",
	"updated_at": "2016-11-28T14:22:58.44874Z",
	"author": {
		"user_id": "",
		"first_name": "",
		"last_name": "",
		"email": "",
		"avatar": ""
		},
	"items": [
		{
			"item_id": "",
			"filename": "",
			"thumbnail": {
				"height": 100,
				"width": 250,
				"path": "/absolute/path/to/image.jpeg",
				"type": "image"
			},
			"order": 1,
			"added_at": ""
		},
		{
			"item_id": "",
			"filename": "",
			"thumbnail": {
				"height": 100,
				"width": 250,
				"path": "/absolute/path/to/image.jpeg",
				"type": "image"
			},
			"order": 2,
			"added_at": ""
		}
	]    
}

Create a new compilation

Add a new compilation, and optionally add item(s) to the compilation

POST /api/data/compilations
{
	"name": "Awesome action movies",
	"public": true/false
}
  • name - Required (string) Human-readable name of the compilation to edit
  • public = Required (boolean) public visibility of compilation

Response

The API will respond with a body exactly like the “Compilation detail” endpoint returns

Update a compilation

PUT /api/data/compilations/{id}
{
	"name": "Great new compilation title",
	"public": false
}
  • id - Required (string) unique ID of the compilation
  • name - Optional (string) new name of the compilation
  • public - Optional (boolean) public status of compilation

Delete a compilation

DELETE /api/data/compilations/{id}
  • id - Required (string) unique ID of the compilation to delete

Add item to a compilation

Add an item to a compilation

POST /api/data/compilations/{compilation_id}/items
{
	"item_id": "3bbf157ea87ad02f55be49dbcdf48cc",
	"display_order": 1
}
  • compilation_id - Required (string) unique ID of the compilation
  • item_id - Required (string) unique ID of item to add
  • display_order - Optional (int) order item should appear in compilation - will default to end of list if not passed

Response

If addition was successful, API will respond as so:

{
    "item_id": "3bbf157ea87ad02f55be49dbcdf48cc",
    "filename": "my-awesome-file.jpg",
    "thumbnail": {
        "height": 480,
        "width": 640,
        "path": "/files/3bbf157ea87ad02f55be49dbcdf48cc/thumbnailer/thumb.jpg",
        "type": "image"
    },
    "display_order": 1,
    "added_at": "2017-07-07T00:26:01.479288Z"
}

WIP: Re-order items in a compilation

Send an array of item id’s in the order you’d like them to appear

PUT /api/data/compilations/{id}/order-items
{
	"items": [
		"5789031d7d551417c16891d475429de3",
		"43na3125b9f5421e1cb5702deb8d45e",
		"5702031d7d551417c16891d475429ab5"
	]
}

Delete item from a compilation

DELETE /api/data/compilations/{compilation_id}/items/{item_id}
  • compilation_id - Required (string) unique ID of the compilation to modify
  • item_id - Required (string) unique ID of the item to delete from the compilation (will NOT delete the item itself)

Clone a compilation

Create a copy (including items) of a compilation

POST /api/data/compilations/{compilation_id}/clone
{
	"new_name": "my cloned comp"
}
  • compilation_id - Required (string) unique ID of the compilation to modify
  • new_name - Required (string) name of cloned compilation

This documentation is generated from the latest version of GrayMeta Platform. For documentation relevant to your own deployed version, please use the documentation inside the application.