1.8 Alpha3 - How do you get a list of the playlist via the API?

I am wondering how does one query the API for a list of Playlist and their id’s?

You mean a list of playlists independent of layouts that “own” them? The answer is you can’t yet - we are still refining this functionality (you’ll notice there isn’t a UI for it yet either)

ok. thank you Dan. Will standby.

Hi Dan,

Can you please tell me if this has been worked out yet?

Not yet.

It will be worked on when we tackle the UI for playlists in 1.9.

I must be missing something.

How should one be using the API to find a layout, it’s regions, and then the playlist on each region?

It’s not well documented, but possible and described in my api guide - 1.8 API Introduction

So pretty much
GET Layouts (might be used with filters) to see list of layouts - so you will have layoutId, regionId on that layout and playlistId in that region.

Example response:

{
    "layoutId": 287,
    "ownerId": 2,
    "campaignId": 287,
    "backgroundImageId": null,
    "schemaVersion": 3,
    "layout": "4K UHD Video",
    "description": null,
    "backgroundColor": "#ffffff",
    "createdDt": "2016-11-14 12:19:04",
    "modifiedDt": "2016-11-14 15:35:52",
    "status": 1,
    "retired": 0,
    "backgroundzIndex": 0,
    "width": 1080,
    "height": 1920,
    "displayOrder": null,
    "duration": 140,
    "statusMessage": null,
    "regions": [
      {
        "regionId": 1127,
        "layoutId": 287,
        "ownerId": 2,
        "name": "Video-1",
        "width": "1080.0000",
        "height": "1704.0000",
        "top": "0.0000",
        "left": "0.0000",
        "zIndex": 0,
        "playlists": [
          {
            "playlistId": 1112,
            "ownerId": 2,
            "name": "Video-1",
            "tags": [],
            "widgets": [],
            "permissions": [],
            "displayOrder": "1"
          }
        ],

If there are more regions / playlist they will be listed there as well.

1 Like

For clarify sake - Peters message shows you how you can get a list of playlists against a layout, which works and is in the 1.8 API.

I thought that your question related to getting a list of Playlists independent of Layouts and working on them separately to Layouts (with a view to assigning more than one Playlist to a Region). This is future functionality and will be implemented in 1.9.

Thank you both Peter and Dan. I believe that will get me what I am after.

Peter,

When I ask for a layout I get a result back but it is missing the information I am after. Any ideas?

Array
(
    [layoutId] => 8
    [ownerId] => 1
    [campaignId] => 8
    [backgroundImageId] => 
    [schemaVersion] => 3
    [layout] => Tablet
    [description] => 
    [backgroundColor] => #000
    [createdDt] => 2016-11-22 21:52:03
    [modifiedDt] => 2016-11-29 02:00:06
    [status] => 1
    [retired] => 0
    [backgroundzIndex] => 0
    [width] => 1920
    [height] => 1080
    [displayOrder] => 
    [duration] => 30
    [statusMessage] => 
    [regions] => Array
        (
        )

    [tags] => 
    [permissions] => Array
        (
        )

    [campaigns] => Array
        (
        )

    [owner] => admin
    [groupsWithPermissions] => Everyone

Right, sorry I forgot to mention one thing!

So normal call is just GET {{url}}/api/layout
You will want to use GET {{url}}/api/layout?embed=regions,playlists

?embed=regions,playlists will let you see regions and playlists.

That got things a bit farther, but the playlist array still seems to be empty.

Array
(
    [layoutId] => 3
    [ownerId] => 1
    [campaignId] => 3
    [backgroundImageId] => 
    [schemaVersion] => 3
    [layout] => 47 Inch Screen Layout
    [description] => 
    [backgroundColor] => #000000
    [createdDt] => 2016-10-17 11:49:37
    [modifiedDt] => 2016-11-29 02:00:06
    [status] => 1
    [retired] => 0
    [backgroundzIndex] => 0
    [width] => 1920
    [height] => 1080
    [displayOrder] => 
    [duration] => 30
    [statusMessage] => 
    [regions] => Array
        (
            [0] => Array
                (
                    [regionId] => 3
                    [layoutId] => 3
                    [ownerId] => 1
                    [name] => TEST2-1
                    [width] => 1920.0000
                    [height] => 1080.0000
                    [top] => 0.0000
                    [left] => 0.0000
                    [zIndex] => 0
                    [playlists] => Array
                        (
                        )

                    [regionOptions] => Array
                        (
                        )

                    [permissions] => Array
                        (
                        )

                    [displayOrder] => 
                    [duration] => 30
                    [tempId] => 
                )

        )

    [tags] => 
    [permissions] => Array
        (
        )

    [campaigns] => Array
        (
        )

    [owner] => xibo_admin
    [groupsWithPermissions] => Everyone
)

EDIT: I solve the issue on my side. The comma and everything after it was getting removed.

Oh I see, I’m glad it finally works for you :slight_smile: