Empty region prevents publishing

So the process I have is creating the layout, getting the draft layout id, add a region to that layout, get that new regions playlist id, add content to that playlist.
When I then try to publish I get an error on an empty region.

I tried just editing the region that there on layout creation but it doesn’t allow it because its “not a draft”
and when I get the draft layout it doesn’t provide me the region details. (I assumed there were none)

I assume there must be an easier way to do this?

Also now that I have most of the process working I have ~12 Callouts chained together which seems like A LOT (Is there a way I can condense some of these down?)
Create a playlist, Enable stats, Add a subplaylist widget, Add content, Create layout, Enable stats, Get draft layout, Add region, Add subplaylist widget, Add content, Create schedule.

Need to
Remove empty region, Publish layout

01%20AM

All new Layouts come with a Region already added.

Well, to be fair, you’re doing quite a lot there - hitting most of the design aspects of the system. However I think there are a few things you could consider to streamline.

  • Create a Template: Get your basic Layout created as a template and add a new Layout using that instead.

  • Use an import: Manipulate your Layout offline in an export, and then import it when you’re happy.

How am I able to edit the existing region and get its Id from the draft?
When I try to edit I get the non draft error or I just cant find the Id.

As discussed already - we’ve created an improvement to return the draft from the Layout Add call. However in the meantime you will need to query to get that back out again.

So use the layout search API and embed the regions.

Do I need to use additional parameters?
I currently use the search endpoint with the parentid and layout but it doesn’t return any region information.
What do you mean by embed the regions?
My apologies if I am being dense…

Also when you talked about export and import is that with the API? Is there an example?

Assuming you’ve called Layout Add and retrieved the layoutId from the response.

So if you look at the Layout Search API you would supply the parentId with the layoutId you’ve got, and the embed parameter with the things you want that layout to return with it - in your case you want regions

I hope that makes sense.

Thanks Dan!
I feel very silly now I somehow didn’t see the embed parameter before.
I was able to get this working to use that region!!
I was also then able to get the layout publish to work as well!

1 Like

Wonderful! I’m pleased that helped. :partying_face::smile:

me too!
I REALLY appreciate all the help and your dealing with my denseness of probably missing obvious or documented things…

1 Like
The Xibo Community site uses cookies. What are cookies?