Script Console

The Script Console is the place for running one-off ad hoc scripts, and for learning and experimenting with the Jira API.

Either enter your script directly in the browser, or click the File tab, and type the path to a file. The file can be a fully-qualified path name to a .groovy file accessible to the server. If you provide a relative path name the file is resolved relative to your script roots.

Check out the Adaptavist Library for Script Console script examples. Read our documentation to learn more about script roots and script plugins.

To access Script Console, navigate to ScriptRunner, and select Script Console from the left-hand menu (or ScriptRunner Tab).

Executing Script Console Scripts Remotely

You can also execute arbitrary code in the Script Console remotely. Due the url encoding this is a bit finicky. Assuming we have the following code in a file called script.groovy


groovy
script.groovy log.debug ("hello") log.debug ("sailor")

We can execute it using the following curl command:

groovy
> curl -u admin:admin -X POST "http://<jira>/jira/rest/scriptrunner/latest/user/exec/" -H "X-Atlassian-token: no-check" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "Accept: application/json" --data-urlencode "scriptText@script.groovy" To execute a file that already exists under a script root:

To execute a file that already exists under a script root:

groovy
> curl -u admin:admin -X POST "http://<jira>/jira/rest/scriptrunner/latest/user/exec/" -H "X-Atlassian-token: no-check" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "Accept: application/json" --data-urlencode "scriptFile=foo/bar.groovy"
On this page