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 );

Posted by:.

One thought on “Groovy REST WS call example to TEMPO JIRA plugin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s