API documentation for deleting and editing playlist widgets?

In the documentation for the api I only see how to get a list of playlist widgets and how to assign media from the library to a playlist. How can I delete that media once it has been added?

I am trying to build a remote content scheduler and without the ability to delete and edit playlist items I am at a bit of a standstill.


It’s coming.

Peter has written it here: https://github.com/PeterMis/xibo-cms/commits/feature/test-suite-2

When that branch is merged down, the Swagger documentation will have that in it.


function deletePlaylistWidget($widgetToDelete){
    $params = [
		'api_method' => 'DELETE',
		'api_path' => 'api/playlist/widget/'.$widgetToDelete,
		'api_data' => [
			'form_params' => ['null' => 'null']
	callService($params, true);


function editPlaylistWidget($widgetDuration, $editWidgetId){
    $params = [
		'api_method' => 'PUT',
		'api_path' => 'api/playlist/widget/'.$editWidgetId,
		'api_data' => [
			'form_params' => [
				'useDuration' => 1,
				'duration' => $widgetDuration,
				'mute' => 1 // Mutes all edited widgets, currently all widgets are edited after adding, so that duration is set. (Note: I set this long a go, this might work correctly now)
	callService($params, true);

Hope this helps

Thanks for this…

I got the widget delete working but I have one question on the functionality. Is there a way to delete more than one widget with a single call?

The function to add media accepts an array which is great because it means I can just track the media id and send an array to create a playlist initially. However, I want the ability to remove all the widgets from a playlist before I send a new array of updated media.

Currently I have this working by getting a list of all the widgets in a playlist and then looping through deleting each widget. This works but is not ideal as a large list of widgets makes a lot of calls to get everything deleted out and it definitely slows everything down considerably.

I assume I could just delete out the entire playlist and create a new one, attach it to the region and then populate it. This seems more complicated than just keeping the existing playlist and deleting the widgets though. Also, the documentation to do that is missing as well.

Not sure if you can delete multiple widgets at a time or not. I would think so, as I see other API calls that make use of multiple items at once. I think you might have to wait on Dan to publish the documentation. Someone passed along a few undocumented items to me, so I saw the opportunity to do the same. Wish I had a better answer for you.

The Edit and Delete use {widgetId} in the path of the call, which means it would be one call per one widget.

The playlist/library/assign call, use the mediaId as a parameter, an array of Ids, in which case it’s possible to pass multiple media Ids in one call.

As you know widget edit do not have a widget type in path (unlike post call which does have it), it made writing documentation for widgets rather challenging, hopefully once published, it will be as user friendly as currently possible.

In the case discussed here, I think we’d need playlist unassign(remove) function that would accept an array of widgets Ids.
Once Dan will have a look at this we will discuss it.

Thanks for getting back to me on this.

I changed up my programming so that it doesn’t try to save changes with every new media item added or removed and instead waits for the user to finish making all their edits to the list before saving. This is probably a better approach anyways. In this case the looping through of each item to delete isn’t too bad. It takes between 10-20 seconds to delete everything out and add a new list of media. This is fine now that it is only one call instead of a call with every change to the list.

Has this functionality ever been implemented? I’m in need of this functionality too. Something with clearing multiple widgets (like /playlist/unassign) in a single call. Or is there an alternative to this solution?

There is no route to mass unassign/remove an array of widgets IDs from a layout, however you can use https://xibo.org.uk/manual/api/#/widget/WidgetDelete in a script that would loop through what you want to remove.

With fully implemented playlists blueprint in 2.0, then it will be possible to edit/delete whole playlists which should make all of that a lot easier.

1 Like

Is there any update on this issue now that version 2.0 has arrived?

I see there is documentation to add, edit and copy a playlist now. I am not seeing documentation to delete a playlist or assign / unassign a playlist from a region.

In my usage scenario i have a custom content scheduler. There will often be multiple displays all with the same playlist. Right now the widget delete loop is painfully slow because for every display I have it has to loop through and delete widgets one at a time. When I have more than one display all with dozens of videos scheduled it can sometimes take 4 or 5 minutes for the scheduling to complete.

Ideally I want to:

  1. create a new playlist (/playlist)
  2. load the content to that playlist (/playlist/library/assign/{playlistId})
  3. assign new playlist to region in display (?)
  4. delete old playlist (?)
  5. Make copies of new playlist (/playlist/copy/{playlistId})
  6. assign copies of playlist to each additional display (?)

Edit: I think I see how this is implemented now. I actually need to:

  1. create a new playlist (/playlist)
  2. load the content to that playlist (/playlist/library/assign/{playlistId})
  3. remove any existing widgets from the default playlist for my targeted region, add a new sub-playlist widget and assign my created playlist…repeat for each additional display(/playlist/widget/subplaylist/{playlistId} and /api/playlist/widget/{widgetId})
  4. delete old playlist (/playlist/{playlistId})