REST endpoint

In addition to Jira native support for loading worklogs via REST as described here, it is possible to get worklogs in json format including issue data using add-ond REST endpoint, as described below.

Supported parameters:

  • start - required start date in YYYY-MM-DD format
  • end - required end date in YYYY-MM-DD format
  • user - optional user key,
  • groups - optional coma separated group names
  • projectid - optional, e.g. 10001 (not project key!),
  • moreFields - optional coma separated list of fields to include in issue details

E.g. request and response:

$ curl -H "Authorization: Apikey T/6r47/KrnOPGqrtyI3aP/KAxnUsJBj7PzdkAqpvl6ijegFscT3pPqWf2pVRWSmL" \
https://timesheet-plugin.herokuapp.com/api/1/worklog?start=2017-08-21\&end=2017-08-31\\&user=admin\&groups=administrators

[
  {
    "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
    "id": "10000",
    "self": "https://primetimesheet.atlassian.net/rest/api/2/issue/10000",
    "key": "DEMO-1",
    "fields": {
      "summary": "As an Agile team, I'd like to learn about Scrum >> Click the \"DEMO-1\" link at the left of this row to see detail in the Description tab on the right",
      "issuetype": {
        "self": "https://primetimesheet.atlassian.net/rest/api/2/issuetype/10000",
        "id": "10000",
        "description": "Created by Jira Agile - do not edit or delete. Issue type for a user story.",
        "iconUrl": "https://primetimesheet.atlassian.net/images/icons/issuetypes/story.svg",
        "name": "Story",
        "subtask": false
      },
      "customfield_10007": null,
      "project": {
        "self": "https://primetimesheet.atlassian.net/rest/api/2/project/10000",
        "id": "10000",
        "key": "DEMO",
        "name": "Demonstration Project",
        "avatarUrls": {
          "48x48": "https://primetimesheet.atlassian.net/secure/projectavatar?avatarId=10324",
          "24x24": "https://primetimesheet.atlassian.net/secure/projectavatar?size=small&avatarId=10324",
          "16x16": "https://primetimesheet.atlassian.net/secure/projectavatar?size=xsmall&avatarId=10324",
          "32x32": "https://primetimesheet.atlassian.net/secure/projectavatar?size=medium&avatarId=10324"
        },
        "projectCategory": {
          "self": "https://primetimesheet.atlassian.net/rest/api/2/projectCategory/10000",
          "id": "10000",
          "description": "",
          "name": "Test Category"
        }
      },
      "issuelinks": [],
      "priority": {
        "self": "https://primetimesheet.atlassian.net/rest/api/2/priority/3",
        "iconUrl": "https://primetimesheet.atlassian.net/images/icons/priorities/medium.svg",
        "name": "Medium",
        "id": "3"
      },
      "resolution": null,
      "status": {
        "self": "https://primetimesheet.atlassian.net/rest/api/2/status/10000",
        "description": "",
        "iconUrl": "https://primetimesheet.atlassian.net/",
        "name": "To Do",
        "id": "10000",
        "statusCategory": {
          "self": "https://primetimesheet.atlassian.net/rest/api/2/statuscategory/2",
          "id": 2,
          "key": "new",
          "colorName": "blue-gray",
          "name": "To Do"
        }
      },
      "worklog": {
        "worklogs": [
          {
            "author": "admin",
            "comment": "test",
            "created": "2017-08-21T22:02:27.140+0200",
            "updated": "2017-08-21T22:02:27.140+0200",
            "visibility": {
              "type": "group",
              "value": "administrators"
            },
            "started": "2017-08-21T20:02:00.000Z",
            "timeSpent": "1h",
            "timeSpentSeconds": 3600,
            "id": "21609",
            "issueId": "10000"
          }
        ]
      }
    }
  }
]

Running REST api standalone

Beside that, it is possible to run same REST service standalone or embed underlying worklog extraction script into other service, without need for add-on installed, please see jiratime project for source code, and feel free to use it as needed.

Export to CSV

It is also possible to pull report in XLS format or raw data in CSV format with a link, like https://timesheet-plugin.herokuapp.com/api/1/exportView.xls?start=2018-10-01 or https://timesheet-plugin.herokuapp.com/api/1/exportData.csv?start=2018-10-01 with HTTP header "Authorization: Apikey KEY". Note, KEY has to be obtained from add-on configuration for REST option, using Get Key button in the very bottom.