using tempo API to add worklog in JIRA on behalf of someone else.

pib-productivity January 18, 2017

I have a oauth for a static account created in JIRA which has permissions to add worklog on behalf of others users. I am using python request library to make a POST call to https://issues.dowjones.net/rest/tempo-timesheets/3/worklogs/ . I am following the following POST (worklog) docs - > http://tempo.io/doc/timesheets/api/rest/latest/#1799179586

and I have the following body :

 

{
workAttributeValues:[
{
value:"Coding*",
workAttribute:
{
sequence:number,
required:True,
externalUrl:string,
type:
{
value:DYNAMIC_DROPDOWN,
name:"DYNAMIC_DROPDOWN"
}
name:string,
key:"_Activity",
id:123,
}
worklogId:number,
id:number,
}
]
issue:
{
remainingEstimateSeconds:number,
key:string,
projectId:number,
}
author:Ignored in PUT operations
{
avatar:url,
displayName:string,
name:"rahners",
self:url
}
comment:"adding worklog",
dateStarted:"2017-01-17T00:00:00.000+0000",
billedSeconds:7200,
timeSpentSeconds:7200
}


but it fails with : 

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://issues.dowjones.net/rest/tempo-timesheets/3/worklogs/

Now All I need to do is add a worklog on behalf of different user for time spent but am confused what exactly the body needs to be. Is there an example of its usage ? or descriptions of the fields used here ?

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
pib-productivity January 19, 2017

perfect, thanks!

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 18, 2017

Hi Kuber,

when creating a worklog with the Tempo API, much less information as given in the documentation is needed. 

I am adding here an example request:

Create a worklog for John for Jan. 19th on Issue WIKK-19. Using worklog attribute "Dynamic Dropdown (Select List)" as given in the Documentation (https://tempoplugin.jira.com/wiki/display/TEMPO081/Tempo+dynamic+drop-downs)  and Account "Wikkkieea Salesforce Connector" (which is linked to the WIKK Project)

 

http://localhost:8080/rest/tempo-timesheets/3/worklogs/       Header: Content-Type application/json

 

{
"timeSpentSeconds": 12600,
"billedSeconds": 360,
"dateStarted": "2017-01-19T12:00:00.000+0000",
"comment": "testing",
"author": {
"name": "john"
},
"issue": {
"key": "WIKK-19",
"remainingEstimateSeconds": 59400
},
"worklogAttributes": [
{
"value": "yellow",
"key": "_Color_"
},
{
"value": "Wikkkieea Salesforce Connector",
"key": "_Account_"
}
]
}

 

Hope this helps,

Regards,

Susanne

Edrich Van Loggerenberg June 19, 2017

Hi Susanne,

 

We are trying to create work logs via the API, but receive the following error:

{
"errors": {},
"errorMessages": [
"The user does not have permission to log work on destination project"
],
"reasons": [
"FORBIDDEN"
],
"flushedErrorMessages": [
"The user does not have permission to log work on destination project"
]
}

 

The API we're calling is: /rest/tempo-timesheets/3/worklogs

Sample Request:

{
"timeSpentSeconds": 3600,
"billedSeconds": 3600,
"dateStarted": "2017-06-06",
"author": {
"name": "Test"
},
"issue": {
"key": "ABC-123"
}
}

 

Any ideas?

 

Kind Regards

Edrich

TAGS
AUG Leaders

Atlassian Community Events