Java Jira API get comments of a ticket

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);
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容