You can change a status with executing the transition.
- You should give the transition id. "{transition\": {\"id\": \"61\"}"
- The url should be : "http://localhost:8080/rest/api/2/issue/TAI-39/transitions?expand=transitions.fields" SElect the issue that you want to update.
- You shoul use "POST"
- Here is the curl command: curl -D- -X POST -H "Authorization: Basic YWRtaW46SDF0MXQ=" --data "{\"transition\": {\"id\": \"81\"}}" -H "Content-Type: application/json" "http://localhost:8080/rest/api/2/issue/TAI-39/transitions?expand=transitions.fields"
- Here is the java implementation:
public static String httpGet() throws IOException {
URL url = new URL("http://localhost:8080/rest/api/2/issue/TAI-39/transitions?expand=transitions.fields");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
String credentials = "username" + ":" + "password";
String encoding = Base64Converter.encode(credentials.getBytes("UTF-8"));
conn.setRequestProperty("Authorization", String.format("Basic %s", encoding));
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
String st = "{\"transition\": {\"id\": \"91\"}}";
byte[] outputBytes = st.getBytes("UTF-8");
OutputStream os = conn.getOutputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuilder sb = new StringBuilder();
while ((line = rd.readLine()) != null) {
System.out.println("sb: "+ sb.toString());
Hiç yorum yok:
Yorum Gönder