Need to import com.konghq:unirest-java:3.13.0
.
HttpResponse<JsonNode> response = Unirest.get(String.format("https://your-domain.atlassian.net/rest/api/3/issue/%s/comment", ticket))
.basicAuth("email@example.com", "<api_token>")
.header("Accept", "application/json")
.asJson();
JSONObject res = response.getBody().getObject();
JSONObject firstComment = (JSONObject) res.getJSONArray("comments").get(0);
String comment = firstComment.getString("body");
System.out.println(comment);
网友评论