I found the below piece of code but am unsure how it should be modified to work with the above API. Any help or similar examples would be much appreciated. BTW I'm on a Mac.
var remoteCode = 'http://remote-site.com/test.js'; //location of your remote file
var script = app.doScript("do shell script \"curl 'remoteCode'\"".replace("remoteCode", remoteCode), ScriptLanguage.APPLESCRIPT_LANGUAGE);
// Set script args
// Set environmental vars
// Run the "remote" script