Hi I think it is better to use REST API directly as you do not need to add any pom dependencies.
Here is the simple example with OkHttpClient (you can use any http client)
OkHttpClient client = new OkHttpClient().newBuilder() .build();
Request request = new Request.Builder()
.url("https://${JIRA_HOST}/rest/api/2/issue/${JIRA_NUMBER}/worklog")
.method("GET", null)
.addHeader("Authorization", "Basic ......................")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Response JSON (omitted some fields):
{
"startAt": 0,
"maxResults": 2,
"total": 2,
"worklogs": [
{
"comment": "Log work",
"created": "2023-03-06T13:25:01.773+1100",
"updated": "2023-03-06T13:25:01.773+1100",
"started": "2023-03-06T13:24:00.000+1100",
"timeSpent": "2h",
"timeSpentSeconds": 7200,
"id": "1269560",
"issueId": "4340529"
},
{
"comment": "Working on unit test",
"created": "2023-03-06T13:25:24.027+1100",
"updated": "2023-03-06T13:25:24.027+1100",
"started": "2023-03-03T13:25:00.000+1100",
"timeSpent": "4h",
"timeSpentSeconds": 14400,
"id": "1269561",
"issueId": "4340529"
}
]
}
Reference link for JIRA REST API: https://docs.atlassian.com/software/jira/docs/api/REST/8.0.2/#api/2/issue-getIssueWorklog