Hi,
I want to use ScriptRunner to control issue with REST APIs.
So I use " api/2/issue/{issueIdOrKey}/transitions " this REST API
Tried to run Issue's transition.
An error has occurred, but I don't know why.
Can You help me?
Thanks.
In addition, the final goal is to receive an issue key using REST endpoint to change the transition id of that issue.
test script :
import groovyx.net.http.RESTClient
import static groovyx.net.http.ContentType.JSON
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
import groovyx.net.http.HttpResponseException
@Grab (group = 'org.codehaus.groovy.modules.http-builder', module = 'http-builder', version = '0.5.0')
def client = new RESTClient('http://localhost:8080')
def jsonObj = new JsonSlurper().parseText('{"transition": {"id": "11"}}')
def response = client.post(path: "/rest/api/2/issue/CH-4/transitions?expand=transitions.fields",
contentType: JSON,
body: jsonObj,
headers: ['Content-Type': 'application/json; charset=UTF-8', 'Accept': 'application/json'])
error message :
groovyx.net.http.HttpResponseException:
at groovyx.net.http.RESTClient.defaultFailureHandler(RESTClient.java:263)
at groovyx.net.http.HTTPBuilder$1.handleResponse(HTTPBuilder.java:503)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:223)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:165)
at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:515)
at groovyx.net.http.RESTClient.post(RESTClient.java:141)
at groovyx.net.http.RESTClient$post.call(Unknown Source)
at Script266.run(Script266.groovy:10)