1.8 CMS API Add Media to Layout, how to get playlistid from Layoutname

Hello,
I am using API for 1.7.x and adding media to layout without problem.
But in 1.8 API adding media system completely change. You are using playlist now.
Campaing have Layout
Layout have Regions
Regions have (multiple) playlists

There is a method for adding media to playlist, (/playlist/library/assign/{playlistId})) it works if you know playlist id. But the problem is how to now playlist id?
If you get Layout list it will list all layouts but wont say which playlist and regions the layout connected to.
How get correct playlistid from Layout name?

THE SOLUTION:
If you use with parameter, it will give you all connected playlist and regions
:
/api/layout?layout=&embed=regions,playlists

{
        "layoutId": 12,
        "ownerId": 2,
        "campaignId": 13,
        "backgroundImageId": null,
        "schemaVersion": 3,
        "layout": "16 AĞUSTOS DHU",
        "description": null,
        "backgroundColor": "#000",
        "createdDt": "2017-08-16 10:59:48",
        "modifiedDt": "2018-01-24 16:45:56",
        "status": 1,
        "retired": 0,
        "backgroundzIndex": 0,
        "width": 1920,
        "height": 1080,
        "displayOrder": null,
        "duration": 2045,
        "statusMessage": null,
        "regions": [
            {
                "regionId": 21,
                "layoutId": 12,
                "ownerId": 2,
                "name": "fds-1",
                "width": "1853.0000",
                "height": "1070.0000",
                "top": "12.0000",
                "left": "96.0000",
                "zIndex": 0,
                "playlists": [
                    {
                        "playlistId": 21,
                        "ownerId": 2,
                        "name": "fds-1",
                        "tags": [],
                        "widgets": [],
                        "permissions": [],
                        "displayOrder": "1"
                    }
                ],
                "regionOptions": [
                    {
                        "regionId": 21,
                        "option": "loop",
                        "value": "0"
                    },
                    {
                        "regionId": 21,
                        "option": "transitionDirection",
                        "value": "N"
                    },
                    {
                        "regionId": 21,
                        "option": "transitionDuration",
                        "value": null
                    },
                    {
                        "regionId": 21,
                        "option": "transitionType",
                        "value": null
                    }
                ],
                "permissions": [
                    {
                        "permissionId": "329",
                        "entityId": "7",
                        "groupId": "2",
                        "objectId": 21,
                        "isUser": null,
                        "entity": "Xibo\\Entity\\Region",
                        "objectIdString": null,
                        "group": null,
                        "view": "1",
                        "edit": "0",
                        "delete": "0",
                        "modifyPermissions": null
                    }
                ],
                "displayOrder": null,
                "duration": "2045",
                "tempId": null
            }
        ],
        "tags": null,
        "permissions": [],
        "campaigns": [],
        "owner": "dogus",
        "groupsWithPermissions": "Everyone"
    },

Thanks
Michael

It is somewhat covered here (in the attached collection I didn’t do a great job at explaining it in the guide itself though) - 1.8 API Introduction

The API documentation also has the embed parameter listed - https://xibo.org.uk/manual/api/#/layout/layoutSearch

I appreciate that it might not be obvious is some cases, we are looking into improving that.

Our oauth2 api library is also under heavy development now, there will be severe changes coming to that as well.

In any case, thank you for your post, I’m sure it will be useful to Xibo community.

If you do have any issues with this or any other API call, please do let me know.

Hey,

Have you found the correct syntax to use for PHP ?