REST end point for Script runner

Hi - we are looking to automatically add new options to our select list and we see that Script runner provides a default build in script to add option. i would like to to know if there is a way we can all the script using REST.

Thanks

Gopinath

 

2 answers

hmmm, you mean adding an option to a JIRA Custom Field Select List via JIRA API? That's NOT possible at all. Currently, JIRA does not expose the Custom Field Administration stuff in the JIRA APIs so it's not possible to configure it other than on the UI itself.

I'm not sure why you thought ScriptRunner can do this though. What "add option" are you talking about here? 

Steven Behnke Community Champion Nov 09, 2015

I'd imagine since they want to use Script Runner to change the fields options, they're wondering if they can target ScriptRunner via REST to run arbitrary JAVA remotely.

0 vote

Hi Gopinath...

I've been meaning to write this up for a while, thanks for prompting me to do it wink

https://scriptrunner.adaptavist.com/4.2.0.2-SNAPSHOT/jira/builtin-scripts.html#_executing_built_in_scripts_remotely

For background, I met Gopinath at Summit, and he explained that he wanted to run the built-in script which bulk updates custom field options programatically.

It's true that JIRA's rest api is woefully short in terms of the configuration stuff. If you're using JIRA server and have SR you can write your own rest endpoints to fill in the gaps to some extent. In this case I'd use the existing built-in script rather than rewriting the code for this, as you need to handle that some options may already exist etc.

I'd imagine since they want to use Script Runner to change the fields options, they're wondering if they can target ScriptRunner via REST to run arbitrary JAVA remotely.

I've added the docs for running scripts in the script console via rest: https://scriptrunner.adaptavist.com/4.2.0.2-SNAPSHOT/jira/builtin-scripts.html#_executing_script_console_scripts_remotely 

My knighthood is still in the post ;-)

Thanks a bunch. you are the Best :)

Hi Jamie - we had a major issue in our production jira instance yesterday and Jira kept becomming un-responsive after an hour. we send all the logs to Atlassian and They came back to us saying that Script running is causing this issue and they asked us to disable it. "Looking at the stack trace error you provided : 2016-01-04 03:39:01,821 http-bio-8443-exec-200 WARN e23475 210x21708x22 gy97z6 172.30.69.189 /secure/QuickCreateIssue.jspa [jira.groovy.jql.ScriptFunctionSearchIndexer] Script runner reindexing failed on ESG-34200 It looks like this issue is caused by the 3rd party plugin called Script Runner. " I also saw this message in the log "2016-01-04 05:45:18,534 http-bio-8443-exec-13 ERROR anonymous 345x11524x6 1nzg9ci 10.6.248.157 /rest/com.onresolve.jira.plugin.Behaviours/1.0/behaviours/validators.json [common.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: Cannot get property 'name' on null object java.lang.NullPointerException: Cannot get property 'name' on null object at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:57) at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:169) at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:44) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:293) something about plugins then it starts with errors like these below : 2016-01-04 05:45:38,865 http-bio-8443-exec-95 ERROR e20264 345x11684x12 4lb1xt 172.30.71.8 /rest/viewIssue/1/remoteIssueLink/render/61160 [viewissue.issuelink.rest.RemoteIssueLinkResource] Error occurred while generating final HTML for r emote issue link: java.lang.RuntimeException: java.io.IOException: Failed to load Confluence Page from remote server Caused by: java.io.IOException: Failed to load Confluence Page from remote server Caused by: com.atlassian.sal.api.net.R esponseException: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate) Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cip her suites are inappropriate) " I use Behaviour plugin a lot for option list manipulation. The plugin is associated to only 1 project and it is not linked to the jira project as mentioned in the first error "ESG-34200" i am not understanding why it is trying to re-index this ticket. Can you help us with this. we are kind of not stuck since we have script runner disabled. Thanks Gopi

Steven Behnke Community Champion Jan 05, 2016

For the love of God ask a new question instead of spamming unrelated questions.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

183 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you