How to connect to ScriptRunner REST Endpoint from SR Behaviour without user authentication?

Bartek Zukowski November 30, 2017

Hi,

I have a REST endpoint that fetches data from an external database. I am using it to convert text field into single select list and that is working like a charm but I also want to use the data provided by that endpoint to populate couple of custom fields. And that is a problem because I don't know how to connect to the endpoint from SR Behaviour.

I tried something simple like HTTPBuilder in the following script:

 

import groovyx.net.http.HTTPBuilder

def builder = new HTTPBuilder('https://myJira.com')
def data = builder.get(path: "/rest/scriptrunner/latest/custom/logistics")
data

 

But it only works if the endpoint isn't restricted to a particular user group and this endpoint must be restricted. I know that I could probably put authentication credentials to HTTPBuilder but it doesn't make sense to me since I am reaching an endpoint in the  same system.

Anyone knows of a way to get to a SR endpoint from groovy script without authentication?

Any suggestions would be very appreciated ;)

Regards,

Bartek

 

1 answer

0 votes
Héctor López February 11, 2019

Hi @Bartek Zukowski,

Did you find a solution for your problem?

In my view, the nicest way of implementing your needs is to use ApplicationLinks feature but unfortunately, Jira cannot have a link pointing to itself. So the closest solution I could think of is to build your own oauth on your SR REST endpoint as an external application.

Héctor

Suggest an answer

Log in or Sign up to answer