API - Create new Playlist and assign to a Region

Hi!

I’m attempting to do something through the API which (I believe) is not documented and it’s failing with a 500 error. I’m trying to create a new Playlist and have it assigned to a specific Region.

URI: {{url}}/api/playlist
Method: POST
Form data in the body:

name: Right Frame
regionId: 84
displayOrder: 0

The error in the log is:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘ownerId’ cannot be null Exception Type: PDOException

My assumption is that this is because it’s setting Permissions and can’t identify the ‘ownerId’ when using the API (since there’s no currently-logged-in user). Is this correct? Any way around this?

Thanks!

Ok, so,

When you create a layout it comes with a region and that region comes with a playlist.
When you create a region, it comes with a playlist.

At this point, only assigning files to a playlist is documented, adding/changing other items like text etc is not documented yet - although someone did ask about changing text via API and I described how to do that.

So basically new region = new playlist for that region, right. (each region has it’s own one playlist)
Once everything will be documented and tested you will be able to do more with that playlist or widgets on the playlist.

If you’re thinking about creating playlists independent from layouts then I don’t think that will work yet - 1.8 Alpha3 - How do you get a list of the playlist via the API?

1 Like