REST API for ToolsOnAir Just:In Engine Calendar

Recently I had a project that required remote systems to create calendar events for ToolsOnAir’s Just:In ingest product. While Just:In supports scheduled record, it is based on the Apple Calendar for scheduling events.

The bad news here is that Apple Calendar local calendars don’t have any method for remote access/sharing. The good news is that Apple Calendar can be manipulated via Applescript. Since the Just:In Multi UI generally runs on a different machine from the Just:In engine, it seemed to make sense to build a way for other systems to schedule records on an engine that may be in a machine room other that Remote Desktop/VNC.

The REST API is written in flask microframework using the flask_restful library for python.

Source code is available on github here:

Once you have the API up and running, working with it is fairly easy. You need to POST data to the API in JSON format. The JSON looks as follows:

	"start_time": "2015-10-14T13:45:30",
	"end_time": "2015-10-14T13:55:30",
	"summary": "NameOfFileWithoutExtension",
	"description": "Description of event for calendar notes",

This data would create an event that started at 1:45:30pm in the timezone of the engine that would end at 1:55:30pm. The output file would be named NameOfFileWithoutExtension.ext (ext being either .mov,.mp4 or .mxf depending on your settings).

This data needs to be POSTed to the URL http://ip.of.engine:service_port/CalendarName

ToolsOnAir Just:In Engine will create calendars in Apple Calendar for the name of each channel you have associated with the Engine. Let’s set up a printed scenario here.

ToolsOnAir Channel name: Router1
ToolsOnAir Engine IP:
API Service Port: 4445
Start Time: October 22nd, 2015 @ 10:45:15pm
End Time: October 22nd, 2015 @ 11:03:33pm
Description: My First Clip

So now we know the URL, port, calendar, and data. We can formulate a simple curl command to send this:

bash-3.2# curl -X POST -H content-type:application/json -d '{"start_time": "2015-10-22T22:45:15","end_time": "2015-10-22T23:03:33","summary": "A_Movie","description": "My First Clip","UID": "1234-5678-9012"}'

On success, this should return JSON encoded success info with success or failure of event registration along with the summary (filename) and UID of the post call.

Because the doesn’t refresh automatically when events are posted in this way, you may need to check and then uncheck a calendar to force a refresh. This doesn’t mean the event isn’t registered, it is simply the UI hasn’t shown it.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.