Skip to content

OcPlaylistsApi

Dennis Benz edited this page Mar 26, 2024 · 5 revisions

This class contains all REST API calls to the /api/playlists endpoint.

Namespace

It is accessible under OpencastApi\Rest namespace.

How to use

  1. In OpencastApi\OpenCast as its property with OpenCast properties naming convention:
use OpencastApi\OpenCast;
$opencastApi = new OpenCast($config);
$ocPlaylistsApi = $opencastApi->playlistsApi;
...
  1. Direct instantiation:
use OpencastApi\Rest\OcRestClient;
use OpencastApi\Rest\OcPlaylistsApi;
$ocRestClient = new OcRestClient($config);
$ocPlaylistsApi = new OcPlaylistsApi($ocRestClient);
...

Functions

Consumable functions are listed below:

getAll($params = [])

Returns the list of playlists. Playlists that you do not have read access to will not show up. More Detail

  • $params is an optional array that could contain the following:
[
    'limit' => (int) {The maximum number of results to return for a single request},
    'offset' => (int) {The index of the first result to return},
    'sort' => {The sort criteria. A criteria is specified by a case-sensitive sort name and the order separated by a colon (e.g. updated:ASC). Supported sort names: 'updated'. Use the order ASC to sort ascending or DESC to sort descending.}
]
  • Returns an array: ['code' => 200, 'body' => '{A (potentially empty) list of playlists}']

get($playlistId)

Returns a single playlist.

  • $playlistId (string) the identifier of the playlist

  • Returns an array: ['code' => 200, 'body' => '{The playlist (object)}']

create($playlist)

Creates a playlist.

  • $playlist (string|array) playlist data

  • Returns an array: ['code' => 201, 'reason' => 'Created', 'body' => '{The new playlist (object)}']

update($playlistId, $playlist)

Updates a playlist.

  • $playlistId (string) the identifier of the playlist

  • $playlist (string|array) updated playlist data

  • Returns an array: ['code' => 200, 'body' => '{The updated playlist (object)}']

delete($playlistId)

Removes a playlist.

  • $playlistId (string) the identifier of the playlist

  • Returns an array: ['code' => 200, 'body' => '{The removed playlist (object)}']

updateEntries($playlistId, $playlistEntries)

Updates the entries of a playlist.

  • $playlistId (string) the identifier of the playlist

  • $playlistEntries (string|array) the playlist entries

  • Returns an array: ['code' => 200, 'body' => '{The updated playlist (object)}']

emptyEntries($playlistId)

Removes all entries of the playlist.

  • $playlistId (string) the identifier of the playlist

  • Returns an array: ['code' => 200, 'body' => '{The updated playlist (object)}']

Clone this wiki locally