Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

how to get accountId on api V3 in java from JiraRestClient.

Lorenzo Ruiz Gómez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 11, 2024

I need to obtain accountId to know Worklogs for a specified user.

 

I´m recovering issues perfectly:

Promise<SearchResult> issuesPromise = jiraClient.getSearchClient().searchJql(
"worklogAuthor%20=%20currentUser()%20and%20worklogDate%20>=%20startOfMonth(-1)%20and%20worklogDate%20<=%20endOfMonth(-1)");
Iterable<Issue> issues = issuesPromise.claim().getIssues();
Integer totalWorklogHours = 0;
for (Issue issue : issues) {
Issue issue2 = jiraClient.getIssueClient().getIssue(issue.getKey()).claim();
Iterable<Worklog> worklogs = issue2.getWorklogs();
for (Worklog worklog : worklogs) {
Integer workLogTime = 0;
workLogTime = worklog.getMinutesSpent() /60;
totalWorklogHours = totalWorklogHours + workLogTime;
}

 

But I don´t know how to recover user with e-mail ( to get Id). This is not working.

Promise<User> user = jiraClient.getUserClient().getUser("emailAddress=xxxx@xxx.xx");

 I need user to know own issues worklogs.

0 answers

Suggest an answer

Log in or Sign up to answer