Hello,
I'm trying to test a REST API call with Groovy in the ScriptRunner console but resp is always null. I can get the same content via PowerShell. Anyone know what I'm doing wrong here?
import groovyx.net.http.HTTPBuilder
import net.sf.json.JSONArray
import org.apache.http.HttpRequest;
import org.apache.http.protocol.HttpContext;
import org.apache.http.HttpRequestInterceptor;
def JIRA_API_URL = "https://mydomain.com"
def jira = new HTTPBuilder(JIRA_API_URL);
jira.client.addRequestInterceptor(new HttpRequestInterceptor() {
void process(HttpRequest httpRequest, HttpContext httpContext) {
httpRequest.addHeader('Authorization', 'Basic ' + 'myuser:mypassword'.bytes.encodeBase64().toString())
}
})
def resp = jira.get(path: '/rest/api/2/issue/WO-440', query : [expand:'renderedFields', fields: '"customfield_11101"'])