Toggl-button: JIRA: create worklog entry after stopping the timer

Created on 18 Dec 2013  路  3Comments  路  Source: toggl/toggl-button

This is actually the main problem I expect from toggl-button to solve, because at the moment we manually copy Toggl time entries to Jira worklog which is inconvenient and error-prone...

Most helpful comment

My bad, I just forgot the Content-Type: application/json header. Although the docs may freak one out, looks like the following body of parameters is enough:

{
  "comment": "I did some work here.",
  "started": "2014-01-06T00:00:12.707+0000",
  "timeSpentSeconds": 12000
}

Even the comment is optional.
The URL format is: https://company.atlassian.net/rest/api/2/issue/PRJ-123/worklog (assuming that you leave adjust estimate to auto which is default).

Looks doable.

All 3 comments

JIRA has REST API that supports authentication via cookies (so you don't have to obtain any additional tokens when issuing a request from within a browser), however it requires quite a lot of data to be supplied:
https://docs.atlassian.com/jira/REST/ondemand/#d2e1312

{
    "self": "http://www.example.com/jira/rest/api/2/issue/10010/worklog/10000",
    "author": {
        "self": "http://www.example.com/jira/rest/api/2/user?username=fred",
        "name": "fred",
        "displayName": "Fred F. User",
        "active": false
    },
    "updateAuthor": {
        "self": "http://www.example.com/jira/rest/api/2/user?username=fred",
        "name": "fred",
        "displayName": "Fred F. User",
        "active": false
    },
    "comment": "I did some work here.",
    "visibility": {
        "type": "group",
        "value": "jira-developers"
    },
    "started": "2014-01-06T00:00:12.707+0000",
    "timeSpent": "3h 20m",
    "timeSpentSeconds": 12000,
    "id": "100028"
}

Tried omitting some parameters and the server didn't like it, will investigate further...

My bad, I just forgot the Content-Type: application/json header. Although the docs may freak one out, looks like the following body of parameters is enough:

{
  "comment": "I did some work here.",
  "started": "2014-01-06T00:00:12.707+0000",
  "timeSpentSeconds": 12000
}

Even the comment is optional.
The URL format is: https://company.atlassian.net/rest/api/2/issue/PRJ-123/worklog (assuming that you leave adjust estimate to auto which is default).

Looks doable.

@dpashkevich - looking into this issue now I'd say we do not intend to post data to JIRA as well in addition to Toggl. But we do have "pipes" (https://github.com/toggl/pipes-api and https://github.com/toggl/pipes-ui) that is fully open-source and can be used to export entries to JIRA. Might want to take a look into it...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dianetoggl picture dianetoggl  路  4Comments

orlando picture orlando  路  5Comments

nicktoggl picture nicktoggl  路  4Comments

jhagberg picture jhagberg  路  3Comments

ricotheque picture ricotheque  路  4Comments