import groovyx.net.http.HTTPBuilder
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.HttpRequest;
import org.apache.http.protocol.HttpContext;
import groovy.json.JsonSlurper;
def JIRA_REST_URL = "https://jira.example.com"
def JIRA_API_URL = JIRA_REST_URL + "/rest/tempo-teams/1/team"
def jira = new HTTPBuilder(JIRA_API_URL);
jira.client.addRequestInterceptor(new HttpRequestInterceptor() {
void process(HttpRequest httpRequest, HttpContext httpContext) {
httpRequest.addHeader('Authorization', 'Basic ' + 'user:password'.bytes.encodeBase64().toString())
}
})
def teams = jira.get(path: JIRA_API_URL );
throw new Exception("First team: " + teams[0].name );
Like this:
Like Loading...
Related
One thought on “Groovy REST WS call example to TEMPO JIRA plugin”