Forums

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

Tempo API: worklogs POST failing with 'User is invalid' (GET is OK)

Kerry Sainsbury November 16, 2017

I'm trying to create a worklog via the Tempo 'worklogs' API, without success.

curl -D- -u myuser:mupassword -X POST -d @worklog.post -H "Content-Type: application/json" 'https://mydomain.atlassian.net/rest/tempo-timesheets/3/worklogs/'

 This is my JSON in the 'worklog.post' file:

{ "issue": 
    {
        "key":"MC-8948"
    },
    "comment":"This is a comment",
    "dateStarted":"2017-11-17T00:00:00.000+1200",
    "timeSpentSeconds":180
}

It fails with 

{"errors":{"worker":"User is invalid","startDate":"Date is invalid"},"errorMessages":[],"reasons":["VALIDATION_FAILED"],"flushedErrorMessages":[]}

I don't believe it's an authentication problem because I can make a GET request without any problem.

I'm under the impression that this is the right documentation, but maybe I'm wrong.

  • How do I define a "worker" that might be valid?
  • How do I define a "startDate", and how is it different from "dateStarted"?

It's all a bit of a mystery!

Thanks heaps.

Kerry
PS: adding ?tempoApiToken to the URL makes no difference

3 answers

1 accepted

0 votes
Answer accepted
Kerry Sainsbury January 13, 2019

See answer above from Susanne Götz

Apparently I was using the wrong end point. Rather than:

https://mydomain.atlassian.net/rest/tempo-timesheets/3/worklogs/

I should've used:

https://api.tempo.io/2/worklogs

Note also that I had success with:

https://mydomain.atlassian.net/rest/api/2/issue/{task}/worklog

More documentation available at https://tempo-io.github.io/tempo-api-docs/#worklogs

0 votes
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.
January 10, 2019

Hi Rahul,

Can you please let us know if you are using the Server or the Cloud version. Each version has their own set of API's and require different authentications.

Regards,
Susanne

Rahul Savaikar
Contributor
January 10, 2019

Good day Susanne,

 

Thank you for the quick response.

 

We use the JIRA DC, here are the details.

 

JIRA:

  • JIRA Software 7.6.9

TEMPO:

  • Tempo Timesheets - 8.6.2 ENABLED
  • System Plugin: Tempo Planning API - 3.10.0 ENABLED
  • System Plugin: Tempo Accounts - 3.4.0 ENABLED
  • System Plugin: Tempo Teams - 3.4.0 ENABLED
  • System Plugin: Tempo Core - 4.5.0 ENABLED
  • System Plugin: Tempo Platform API - 1.4.0 ENABLED
  • System Plugin: Tempo Platform - JIRA - 1.4.0 ENABLED

 

The interesting thing is, it is happening for only one user. There are no complaints from any of the other ~2400 users.

 

 

System.Net.WebException: The remote server returned an unexpected response: (400) BadRequest.

{"errors":{"worker":"User is invalid"},"errorMessages":[],"reasons":["VALIDATION_FAILED"]}

 

 

Regards,

Rahul Savaikar

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.
January 10, 2019

Hi Rahul,

Can you please create a ticket for this in our Tempo support so we can better follow up on this. 

It might be useful to get some more information about the affected user ( f.x if his username was changed ) and the body you are sending with the request.

Regards,
Susanne

Like Rahul Savaikar likes this
Kerry Sainsbury January 10, 2019

@Susanne Götz

It might be nice if they could throw some hints back here too, so the next person might be able to get the problem resolved. (I'm using Cloud version, btw)

That said, I worked around the problem by not using the Tempo API at all. I'm instead calling:

 https://mydomain.atlassian.net/rest/api/2/issue/{task}/worklog
Like Rahul Savaikar 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.
January 10, 2019

Hi @Kerry Sainsbury

To create a worklog on Cloud using the Tempo API, you will need to use:

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

The authorization is done via Bearer Token ( you can find or generate your bearer token in Tempo, Settings, API Integration).

Please take also a look at https://tempo-io.github.io/tempo-api-docs/ for more information.

Regards,
Susanne

Like Kerry Sainsbury likes this
0 votes
Rahul Savaikar
Contributor
January 10, 2019

@Susanne Götz _Tempo_ - Can you please help here?

 

I too am facing a similar issue and haven't found any leads on it.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events