API PublishNow problem

Hello i have strange problem with Publishing via API, as you can see on image that i have “new” layoutId but i always get Draft reponse - when i go to xibo cms it is on draft mode and publish is working just fine.
I have tried every idea that i think that can solve this…

Also i would like to upload/change HTMLPackage via API and here is swagger option

/playlist/widget/{widgetId}?htmlPackage

Is this real because text says…

Edit a Local Video Widget

When you checkout a layout that changes the original layout publishedStatus to draft, creates a new draft layout (not visible in web ui) with parentId set to the original layoutId.
You can use the layoutId of the “child” layout to edit it, add/edit widgets etc.

However, layout publish is called on the parent layout ie in your case that would 63

If you’re using 2.1 CMS, you will also want to pass publishNow flag in the layout publish request (or date if it should be published on the specific date/time).

Regarding edit widget api calls, all of them use PUT /api/playlist/{widgetId} path, the ? after that in the documentation is there just to make it clearer ie so you can see parameters relevant for the specific widget.

That being said, unfortunately the htmlPackage widget didn’t have documentation in 2.1 and as you correctly pointed out the ?htmlPackage in documentation was actually for localVideo Widget.

We’ve made quite a lot of adjustments in API documentation for 2.2 release, it will be live in the manual when the 2.2 CMS version will be officially released.

In the meantime, you can check the parameters here:
https://github.com/xibosignage/xibo-cms/blob/develop/lib/Widget/HtmlPackage.php#L118

I hope that will help you.

I have tried to put publishNow inside body with formdata request (also as parametar) and it isn’t working at all…Please can you check what i am doing wrong or if it not working at all ?

Hello,

I’m having the same issue as described here. I can’t publish the layouts via the API.

I tried to use the ID of the draft “child” layout and the ID of the parent, using the api publish option “/api/layout/publish/33?publishNow=1” with no success. :frowning:

I’m using the cloud version 2.3.3

Hi,

The Layout publish takes the layoutId of the parent - ie the one you can see in web ui.

You do indeed need to pass the publishNow parameter with the call, however since it is PUT request, two important changes need to be made to your call.

1 - All PUT requests need to have Content-Type application/x-www-form-urlencoded header
in Postman you can just click on application/x-www-form-urlencoded when on the body tab

2 - POST AND PUT calls that take parameters need to have them passed in body not in query string

The call and response should look something like that:
image

You will see the layoutId changed and publishedStatusId is now 1 (Published) and parentId null, those are the important bits from the response.

I hope that helps.

Hi Peter,

Tried your solution and it’s working now. :slight_smile:

Many thanks