Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Managing API Scripts

I am updating my Python script that manages my API scripts. I am able to add, remove and update hand-rolled scripts. However I am currently unable to do the following: Add/Remove a pre-written script. * Restart the Sandbox. Does anyone know a way to do either of the above, expect by using the Roll20 web site.  Say for example using curl Thanks in advance Chris
1640409067

Edited 1640410267
Oosh
Sheet Author
API Scripter
You can install a script pretty easily from the console, presumably the same deal with curl, though I guess it depends on being logged in and having write access. Replace the /000000/ with the identifier from your own Campaign, of course:   $ . post ( "/campaigns/save_script/000000/" + 'new' , {     name : 'newScript' ,     content : `log('hello Slowglass');`   } If you .then() or await the ajax request, you could refresh the browser when it's done. Otherwise you won't see the new script.If that even matters - probably not, since you're trying to do this without the website. Presumably any type of ajax post will work, I only used the JQ version since that's what the button does. The restarting I'm not sure on. It could definitely be done by triggering a script via the a message in the API console (so you can do it from in-game with a macro), but that would mean leaving a tab open on the API scripts page, so the triggered script can send a 'click' event to the restart button. But if you're ok with that, it's pretty easy. The Roll20 button itself is posting a restart event on an object called Notifier - not sure if that means anything to you, but I'm not sure what scope that's in, or whether it's from a certain library. notifier.child("scriptrestart").set(true); It looks like firebase syntax, but that seems like an odd use of a firebase document. Then again, I've written a total of 0.8 firebase apps, so /shrug :) edit - Yeah, it's firebase alright. Permission denied on the restart document thought, which is odd. I think the API console trigger might be the only option. Can't do a read, let alone a write:
Thanks, I have found a way to push up predefined scripts as well as home written ones. Need to step through the notify code, but do not think there is a way to restart the Sandbox form the command line