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

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
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 Jun 14, 2018 in Jira Service Desk

How the Telegram Integration for Jira helps Sergey's team take their support efficiency to the bank

...+ reading Fantasy). The same is true for him at the bank he works for: Efficiency is key when time literally equals money. Read on to learn how Sergey makes most of the time he has by...

522 views 3 5
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