API - Troubles trying to get the ID of a playlist, region, and widget

Hello,

I am using the Xibo API and while I was searching for a way to get the ID of a region, playlist and widget, I saw that I could write something to embed datas about regions, playlists, tags, etc…
(https://xibo.org.uk/manual/api/#/layout/layoutSearch)

I wrote this line : $getLayoutWhere = (new Xibo\OAuth2\Client\Entity\XiboLayout($entityProvider))->get(array(‘layoutId’=>75));
but I have no idea how to tell Xibo to embed the datas about regions and everything.

Any solutions ?
Thanks

it’s the embed parameter that would want to include in your GET call.
https://xibo.org.uk/manual/api/#/layout/layoutSearch

ie for example:
/api/layout?layoutId=75&embed=regions,playlists,widgets

I don’t really understand how to use what you told me.

I am using this : GitHub - xibosignage/oauth2-xibo-cms: Xibo CMS Provider for league/oauth2-client

In this line for exemple, I am trying to get the layout with the ID 75 to display the datas, and it’s working, but what should I modifie/add to see the datas about the regions or playlists related to this layout ?

Still no solution yet ?

$layout = (new \Xibo\OAuth2\Client\Entity\XiboLayout($entityProvider))->get(['layoutId'=>75, 'embed'=>'regions,playlists,widgets']);

something like that.

Hey,

I’ve tried it but unfortunatly, I had the same result as before

Here is a screenshot of what I get when calling:
$layout = (new \Xibo\OAuth2\Client\Entity\XiboLayout($entityProvider))->get([‘layoutId’=> 48, ‘embed’=>‘regions,playlists,widgets’]);

image

It’s working within postman with that query : {{url}}/api/layout?layoutId=48embed=regions,playlists,widgets

but I still haven’t found the correct syntax I can use in PHP.

The v1.1 PHP api library that you use, does not have region, playlists and widgets as objects when you call get layout, while in v2 you have this on get: https://github.com/xibosignage/oauth2-xibo-cms/blob/develop/src/Entity/XiboLayout.php#L130

Which then gives you the following response, if you have the embed parameter provided:

[0] => Xibo\OAuth2\Client\Entity\XiboLayout Object
        (
            [url:Xibo\OAuth2\Client\Entity\XiboLayout:private] => /layout
            [layoutId] => 330
            [ownerId] => 1
            [campaignId] => 16
            [parentId] => 0
            [publishedStatusId] => 1
            [publishedStatus] => Published
            [backgroundImageId] => 0
            [schemaVersion] => 3
            [layout] => PDF test
            [description] => 
            [backgroundColor] => #a2fad0
            [createdDt] => 2019-02-27 09:23:50
            [modifiedDt] => 2019-02-27 09:25:35
            [status] => 1
            [retired] => 0
            [backgroundzIndex] => 0
            [resolutionId] => 
            [width] => 1920
            [height] => 1080
            [displayOrder] => 
            [duration] => 80
            [statusMessage] => 
            [enableStat] => 
            [regions] => Array
                (
                    [0] => Xibo\OAuth2\Client\Entity\XiboRegion Object
                        (
                            [url:Xibo\OAuth2\Client\Entity\XiboRegion:private] => /region
                            [regionId] => 438
                            [layoutId] => 330
                            [ownerId] => 1
                            [width] => 1920
                            [height] => 1080
                            [top] => 0
                            [left] => 0
                            [zIndex] => 0
                            [loop] => 
                            [transitionType] => 
                            [transitionDuration] => 
                            [transitionDirection] => 
                            [regionPlaylist] => Xibo\OAuth2\Client\Entity\XiboPlaylist Object
                                (
                                    [playlistId] => 486
                                    [ownerId] => 1
                                    [name] => PDF test-1
                                    [regionId] => 438
                                    [isDynamic] => 0
                                    [filterMediaName] => 
                                    [filterMediaTags] => 
                                    [createdDt] => 2019-02-27 09:23:50
                                    [modifiedDt] => 2019-02-28 16:18:25
                                    [duration] => 80
                                    [tags] => Array
                                        (
                                        )

                                    [widgets] => Array
                                        (
                                            [0] => Xibo\OAuth2\Client\Entity\XiboWidget Object
                                                (
                                                    [playlistId] => 486
                                                    [widgetId] => 613
                                                    [ownerId] => 1
                                                    [type] => pdf
                                                    [duration] => 60
                                                    [displayOrder] => 1
                                                    [useDuration] => 1
                                                    [widgetOptions] => Array
                                                        (
                                                            [0] => Array
                                                                (
                                                                    [widgetId] => 613
                                                                    [type] => attrib
                                                                    [option] => name
                                                                    [value] => 
                                                                )

                                                        )

                                                    [mediaIds] => Array
                                                        (
                                                            [0] => 151
                                                        )

Hi,

So I tried installing the V2 following the README file at that link (GitHub - xibosignage/oauth2-xibo-cms: Xibo CMS Provider for league/oauth2-client), but it has installed a v1.1 version.
image

I’ve tried to copy and past the files directly downloaded from the link and replace the folder created by the composer and it didn’t work either

Any way to get the v2 ?

Fixed it!

Had to delete the folder content, then run “composer require xibosignage/oauth2-xibo-cms”
Then I went into the composer.json file and edited it like that :
image
Finaly I runned “composer update” and that’s it.