Where do I get the correct value for the "worker" to create a Worklog using Jira Tempo API?

Gene Dascher May 2, 2023

To create a worklog via the Jira Tempo API, I would POST the following data:

{
"attributes": {
"_Activity_": {
"name": "Activity",
"workAttributeId": 1,
"value": "Research"
}
},
"billableSeconds": null,
"comment": null,
"remainingEstimate": null,
"originTaskId": "PROJECTX-2",
"timeSpentSeconds": 10944,
"worker": "janedoe",
"started": "2021-03-22",
"endDate": "2021-03-26T00:00:00.000"
}

 Where do I get the value I'm supposed to send with the "worker" key?  I've tried different variations of my name, including my email address and the workerId that is returned when I pull data for an existing worklog, but I still get the same response:

HTTP/2 400
{"errors":{"worker":"User is invalid"}}

1 answer

1 vote
Susanne Götz _Tempo_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 2, 2023

Hi @Gene Dascher


Can you please confirm if you are using the Server/DC or Cloud version of Tempo? 

Your question is marked as jira-software-cloud, but the payload in your screenshot is for the Tempo Timesheets REST API for the Server/DC version.

For information about the Tempo Cloud REST API to create worklogs, please take a look at this page.
On Cloud, the JIRA user account id needs to be used. This information is displayed, e.g., in the URL, when viewing a user in the JIRA user management. 

Best regards,
Susanne Götz
Tempo team
 

Dave Rosenlund
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 2, 2023

To add (just a little) to what @Susanne Götz _Tempo_ says,  from this end it looks like you are indeed on Jira Cloud, @Gene Dascher.

You may have inadvertently reviewed our Server/DC API docs, vs our Cloud API docs.

You may also wish to consider joining the Tempo slack workspace for developers (let me know if you're interested and I will send and invite).

Best,

-dave

Like Gene Dascher likes this
Gene Dascher May 2, 2023

I'm using the Cloud version. Here is the exact payload that I'm sending to https://api.tempo.io/tempo-timesheets/4/worklogs:

{"billableSeconds":5400,
"timeSpentSeconds":5400,
"comment":"Development time spent on AA-1234",
"started":"2023-04-25",
"originTaskId":"AA-1234",
"worker":"[user id value]"}

The value I sent for "workerId" is the value I see at the end of the URL when I go to our Jira page in my browser, click on my user icon in the top right of the page, then choose "Profile", which takes me to the URL : "https://[our URL]/jira/people/[user id value]".  I'm using the value at the END of that URL that I have noted as "[user id value]".  I'm still getting that same "User is invalid" error.

Like Dave Rosenlund likes this
Dave Rosenlund
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 2, 2023

Looks like we were typing at the same time, @Gene Dascher  🤪

You do have the right docs. at hand. I'm sure @Susanne Götz _Tempo_, or someone else will chime in based on the new details.

Like Gene Dascher likes this
Susanne Götz _Tempo_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 2, 2023

Hi @Gene Dascher 

Thank you for confirming that you are using the Cloud version. 

Can you please change the REST API for this call to 

POST  https://api.tempo.io/4/worklogs 

and the payload should be similar to 

{
     "issueId": "12345",
     "timeSpentSeconds": 5400,
     "billableSeconds": 5400,
     "startDate": "2023-05-02",
     "startTime": "10:06:00",
     "description": "Creating a worklog via REST API",
     "authorAccountId": "557058:cc8b3ba1-1268-446e-abcd1234",
     "remainingEstimateSeconds": 18800
 }

Please take a look at Tempo Cloud Worklog REST API for more information. 

Best regards,
Susanne 

Like Dave Rosenlund likes this
Gene Dascher May 2, 2023

@Susanne Götz _Tempo_ where do I get the value for "issueID"? I searched that entire document you sent the link to and the only place I see issueID is in the worklog section. I don't see how to retrieve the issueID via the API.

Like Dave Rosenlund likes this
Susanne Götz _Tempo_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 3, 2023

Hi @Gene Dascher

The issueId is a value that is provided by JIRA, so there is no Tempo REST API to retrieve this information for an issue. 

You can retrieve this information with a JIRA REST API by using the issue key

GET  YOUR_JIRA/rest/api/3/issue/{issueIdOrKey}

(see https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-get)

The issue key can also be seen when exporting the issue to XML (use the "..." in the upper right corner of the issue view and select "Export XML").

Best regards,
Susanne

Like Dave Rosenlund likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events