Currently
I have a GET request in ScriptRunner listener that looks like:
def jql = URLEncoder.encode("issue in (" + children.join(",") +")", "UTF-8");
//restrict GET request to minimum required fields
def fieldQuery = "&fields=issuelinks,customfield_10121,summary,customfield_10083,customfield_10122"
def response = get("/rest/api/2/search?jql=" + jql + "&startAt=0&maxResults=1000" + fieldQuery)Issue
The above request fails with log message:
2019-07-30 23:33:56.165 WARN - GET request to /rest/api/2/search?jql=issue+in+%28PD-3874%2CPD-3396%2CPD-2335%2CPD-3008%2CPD-2549%2CPD-2691%2CPD-2755%2CPD-2780%2CPD-2851%2CPD-3415%2CPD-3648%2CPD-3810%2CPD-3884%2CPD-3886%2CMAP-326%2CMAP-329%2CMAP-104%2CMAP-83%2CMAP-84%2CMAP-85%2CMAP-86%2CMAP-87%2CMAP-88%2CMAP-89%2CMAP-229%2CMAP-243%29&startAt=0&maxResults=1000&fields=issuelinks,customfield_10121,summary,customfield_10083,customfield_10122 returned an error code: status: 401 - Unauthorized
body: java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
at [Source: (String)""; line: 1, column: 0]
Question
Why is this Search GET request returning unauthorized, but if I make a REST API request for a single issue i.e.
def response = get("/rest/agile/1.0/issue/${issueKey}") ...there is no issue.
What can I do to get my Search request working?