Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,365,865
Community Members
 
Community Events
168
Community Groups

Groovy REST API call Response

import groovyx.net.http.HTTPBuilder
import groovyx.net.http.Method

def remote = new HTTPBuilder("https://myjiraurl")
def issueJson = remote.request(Method.GET) { req ->
uri.path = "/api/v1/token"
headers.'Authorization' =
"Basic ${"username:password".bytes.encodeBase64().toString()}"

response.success = { resp, json ->
json ?: [:]
}
}

I am using above groovy code and able to get following output:

[access_token:9hf5ba12-c78a-48b4-a8e9-20d75ecgb552, code:200]

 

Now I want to hit another REST API and use above access_token in header to get JSON data. And from that JSON data I want to parse one field.

 

Can someone PLEASE help?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events