/** * Runs the provided groovy script on the server and returns the result. * * This is similar to running groovy scripts using the script console. * * In the instance where your script causes an exception, the server still * returns a 200 status, so detecting errors is very challenging. It is * recommended to use heuristics to check your return string for stack * traces by detecting strings like "groovy.lang.(something)Exception". * * @param script The script to run. * @param crumbFlag <code>true</code> to add <b>crumbIssuer</b> * <code>false</code> otherwise. * @return results The results of the run of the script. * @throws IOException in case of an error. */ public String runScript(String script, boolean crumbFlag) throws IOException { return client.post_text("/scriptText", "script=" + script, ContentType.APPLICATION_FORM_URLENCODED, crumbFlag); }