Need help to schedule a layout on event

Hello,
my name is Giulio i’m new here i have installed xibo on ubuntu as server and have client on Windows 10.
I work in a metro, i need to schedule a layout when the train arrives and unschedule it when train goes away.
i read something about it here regarding the use of API, but unfortunately i don’t have any experience with it.
So can anyone help me to understand how i can solve the task or give me some related documentation for it?
thanks in advance.

Kind regards

While yes you can create the event and then remove the event manually in webui or via API (or use changeLayout action via API), I assume you’d want that to happen automatically without manual intervention, for that to work there would need to be some sort of integration written, ie when the train arrives it would trigger the API script, if there is a system in place that could handle that, then it might be possible to integrate it with Xibo API.

Regarding API guide, documentation and those calls I’ve mentioned you can have a look here - 1.8 API Introduction (that’s only for 1.8 series).

Thank you, i created a curl script with Postman for schedule and unschedule layout. With postaman i need a token that expire in a few minutes, my question is…can i bypass the token or there is some way to get it automatically? Other question is, is there a way to have the same itemId schedule?
Thank in advance

the token should stay alive for 1hour and it will be needed to use other API calls.

We’re in the process of looking into our oauth2 and what can we do to improve the token handling among other things.
In postman you’d need to call the access_token if it expired, in ‘normal’ code you can have a refresh token line that would should take care of it.

Just so I’m sure I understand, could you please elaborate a little?

When i schedule a layout in Postman i set eventId to 20 then if i delete the schedule and i try to schedule it again it take an incremental Id such as 21 and so on. So the script to delete the schedule don’t work because i need the correct itemId (for example curl -X DELETE {{url}}/api/schedule/20 where 20 is the itemId). Tell me if I’ve made any mistakes.
If you want i can post or pm you the postman/curl script

Right I see, the eventId will be incremented each time you create a new event, I’m not 100% sure about postman, but in code you should be able to save that id and then pass it to the DELETE schedule/{eventId}

You can have a look at my test - https://github.com/xibosignage/xibo-cms/blob/develop/tests/integration/ScheduleTest.php#L350

that’s using oauth2 wrappers, but without wrappers the logic will be the same.

Thanks for your help, i completed the script to schedule layout automatically.
One question… is it possible to make sub display group?