Skip to content

Pages

Get all Pages

GET /api/pages

Returns all the Pages that are currently available in your Erizos Studio environment.

Response

The response is an array of Pages

Supports the list query parameters. GET /api/pages/info returns { "count": n } for the same filter.

Create a Page

POST /api/pages

Creates a new page in a show.

Info

This API call will create a new page that can be used in other API requests, but the page will not be visible in Erizos Studio. To make the page available in Erizos Studio, you will need to use the Add Pages to a Playlist API call.

Request Body

1
2
3
4
5
6
{
  "show": "5d9f3427238f9f0e53b030f2",
  "name": "My New Page",
  "template": "5dada247f0f446a83ef4a3ed",
  "summary": "A Description of My Page"
}

Parameter Value Description
show UUid Required. The id of the show the page belongs to
name String Required. The name of the page
template UUid Required. The id of the template the page is created from
summary String A description of the page
description String A longer description of the page
num String The page number
playlists Array The ids of the playlists the page belongs to. A page created through this call is normally left out of every playlist. Up to 3.6 this is playlist, a single id
channel String Overrides the channel the page is taken on
layer String Overrides the layer the page is played on
fields Array The field values of the page
source Object Set when the page comes from an external system
externalData Object Free-form data attached by an external system

Note

color is not a page property. If you send one it is discarded. See Add Pages to a Playlist, where color sets the colour of the playlist item.

When a fields value refers to a storage asset, that asset is copied into the new page's own storage, so the page keeps working if the original is removed.

Response Body

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
    "_id": "5f490e4c9a230f71d7972d45",
    "show": "5d9f3427238f9f0e53b030f2",
    "name": "My New Page",
    "template": "5dada247f0f446a83ef4a3ed",
    "summary": "A Description of My Page",
    "fields": [],
    "createdAt": "2020-08-28T14:01:48.984Z",
    "updatedAt": "2020-08-28T14:01:48.984Z",
    "_type": "PAGE"
}

Parameter Value Description
show UUid The id of the show the page belongs to
name String The name of the page
template UUid The id of the template the page is created from
summary String A description of the page
fields Array A list of fields in the page
createdAt Date Date and time the page was created
updatedAt Date Date and time the page was last updated

Get Page by ID

GET /api/pages/[ID]

Returns the page that corresponds to the page ID.

Request

Parameter Type Description
ID Uuid id of the Page

Response

Page Object

Copy a Page

GET /api/pages/[ID]/copy

Creates a new page from an existing one. Requires the Pages Create permission on the show the page belongs to.

Request

Parameter Type Description
ID Uuid id of the Page to copy

The copy is rebuilt from four properties of the original only:

Property Description
show The copy belongs to the same show
template The copy uses the same template
name The copy has the same name. It is not suffixed or made unique
fields The field values are carried over. Any storage asset referenced by a field is duplicated into the new page's own storage

Everything else is dropped. The copy gets a new _id and new createdAt / updatedAt timestamps, and the following properties are not copied:

num, description, summary, channel, layer, source (including source.favorite), externalData and playlists (playlist up to 3.6).

Info

Because playlists and num are dropped, the copy is created outside any playlist and is not visible in Erizos Studio. Use Add Pages to a Playlist to place it.

Response

The new Page object.

Duplicating a Page

There is no single call that duplicates a page into a playlist. Read the original page and create a new one from it.

The template id is on the original page itself, in its template property. Read the page with Get Page by ID and use that value.

Duplicate into a playlist (visible in Erizos Studio)

  1. Read the original with GET /api/pages/[PAGE ID].
  2. Remove _id, num, createdAt and updatedAt from it. Keep template, name, fields and anything else you want carried over. If num is left in, the call fails with Page ID <num> already exists. Without it the next free page number is allocated.
  3. Send it to Add Pages to a Playlist with POST /api/playlists/[PLAYLIST ID]/items/add/pages.

To place the copy directly below the original, pass the original's playlist item id as position.after. That is the _id of the playlist item whose page is the original page's id, not the page id itself. Read it from Get Playlist by ID. Items inside a GROUP are nested in that group's items. Without position, the copy goes to the end of the playlist.

Any storage asset referenced by the original's fields is copied into the new page's own storage, so the two pages do not share assets.

In the example, api.get and api.post stand for your HTTP client, authenticated as described in Authentication.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const pageId = '6512b1e0a1f4c93d5a70e113';
const playlistId = '5e1b55bfc6e1457e208d11b7';

const page = await api.get(`/api/pages/${pageId}`);
const playlist = await api.get(`/api/playlists/${playlistId}`);

// find the playlist item that points at the original page (groups are nested)
const findItem = items => {
  for (const item of items ?? []) {
    if (item.page === pageId) return item;
    const found = findItem(item.items);
    if (found) return found;
  }
};
const item = findItem(playlist.items);

const { _id, num, createdAt, updatedAt, ...copy } = page;

const [created] = await api.post(`/api/playlists/${playlistId}/items/add/pages`, {
  pages: [copy],
  position: { after: item?._id }
});
// created.page is the new page, created.item is its playlist item

Duplicate without a playlist

Copy a Page (GET /api/pages/[ID]/copy) creates a copy from the original's show, template, name and fields. Sending the original page to Create a Page (POST /api/pages) without its _id, num and playlists (playlist up to 3.6) keeps every other property as well. Either way the copy is not visible in Erizos Studio until it is placed in a playlist.

Update a Page

PUT /api/pages/[ID]

Updates the page.

Request

Parameter Type Description
ID Uuid id of the Page
updateTimestamp Boolean (query) Pass updateTimestamp=true to have the page's updatedAt moved to now. With any other value, or when the parameter is left out, updatedAt is left as it was

The body is a partial Page: any of the properties listed under Create a Page may be sent, including fields and num.

Request Body

1
2
3
4
{
    "name": [PAGE NAME (STRING)],
    "summary": [PAGE SUMMARY (STRING)],
}

Response

The updated Page object.

Create or Delete many Pages at once

POST /api/pages/batch

Creates several pages in one request. The body is an array of Page objects, each shaped as under Create a Page. The response is the array of created pages.

POST /api/pages/batch/delete

Deletes several pages in one request. The body is an array of page ids. The response is the array of deleted pages. The same cascade as Delete Page by ID applies to each page.

1
2
3
4
[
    "5f490e4c9a230f71d7972d45",
    "5f490e4c9a230f71d7972d46"
]

Mark Pages as Favourite

POST /api/pages/batch/favorite

Sets or clears source.favorite on the listed pages.

1
2
3
4
5
6
{
    "ids": [
        "5f490e4c9a230f71d7972d45"
    ],
    "favorite": true
}

Delete Page by ID

DELETE /api/pages/[ID]

Deletes the page that corresponds to the page ID.

Request

Parameter Type Description
ID Uuid id of the Page

Note

Deleting a page also deletes the storage assets belonging to it, and removes the page's items from every playlist that referenced it.

Get Page Thumbnail

GET GET /api/pages/[PAGE ID]/thumbnail

Returns the thumbnail that corresponds to the page ID

Request

Parameter Type Description
ID Uuid id of the Page

Response

A 302 redirect to Get Template Thumbnail for the page's template. When the template is in LAYERS mode and the page has exactly one field, the redirect points at that layer's thumbnail instead. If the page or its template cannot be read, the response is 404.