ScriptRunner - How to form a get request inside Jira

Hello Community,

I have been looking for ways to construct a get request inside Jira.

I want to use the rest API inside a Behavior to fetch certain board related data: 

<jira Base URL>/rest/agile/1.0/board/{board Id}/configuration

Would anyone know how I can form a get request inside Jira as to receive a response from the url mentioned.

Thank you for your time and expertise!

-Roberto

 

 

1 answer

1 accepted

Accepted Answer
1 vote

Hi Roberto.

I recently did an answer on how to use our HTTP request method from inside JIRA to make a request to any link. You can find relevant information in that question.

If you are still struggling. Could I ask you to give me an specific example of what it is that you want to accomplish? 

Cheers

Dyelamos

Hi @Daniel Yelamos [Adaptavist],

i read the attached community post.

i tried implementing the solution on my end but I got authorization errors.

i am trying to use a get request to get the information related to a board by passing the board Id to a REST API.

the API is: board/{boardID}/configuration

Do I need to pass my Jira credentials to the http request? If so how can I do so?

i appreciate your help!

-Roberto

Hi @Daniel Yelamos [Adaptavist]@Nic Brough [Adaptavist]

 

I have tried using the examples in the article you sent over in your last response but I have been getting this error: 

groovyx.net.http.HttpResponseException: Unauthorized

 I am doing the following in my code:

import groovyx.net.http.ContentType
import groovyx.net.http.RESTClient

def boardId = '3';
def activitiRestClient = new RESTClient("<Jira Base URL>/rest/agile/1.0/board/")
activitiRestClient.auth.basic "USERNAME", "PASWORD"

def response = activitiRestClient.get(
path: boardId+'/configuration'
)

output+="\nresponse: "+response+"\n"

Could you provide some pointers as to why this isn't working for me?

Thank you!!

-Roberto

Roberto. If you are getting that response it can mean one of two things:

1. Your request isn't well formed.

2. your username and password are not correct.

The best way you have of testing this would be to use a rest call plugin in firefox or similar, or the terminal if you are well versed and send the petition. Once and only once you get a proper response, compare the packages and see what the difference is. Then you will find why you are getting the auth error.

Cheers

Dyelamos

@Daniel Yelamos [Adaptavist],

Thank you, I forgot what I did but I ended up solving the issue.

-Roberto

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

25,488 views 2 7
Join discussion

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