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?
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.