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 at https://timesheet-plugin.herokuapp.com/api/1/* with your Apikey, as described below.

Note, timesheet-plugin.herokuapp.com has to be unchanged, but you will need to provide your Apikey (which is your Jira url and user encoded), and you have to obtain it in app Configuration, General tab, accessible within Gear icon on report page.

Supported parameters:

  • start (or startDate) - required start date in YYYY-MM-DD format
  • end (or endDate) - required end date in YYYY-MM-DD format
  • user - optional user account id
  • groups - optional group names
  • allUsers=true - optional
  • filterOrProjectId - optional, e.g. filterOrProjectId=project_TIMES&filterOrProjectId=filter_10010
  • moreFields - optional list of fields to include in issue details

Note, it might be possible to use url from report page after the hash-bang( #!) delimiter in REST also.

Note, in case of long polling request response will contain status 202 and content-type omitted, also several empty lines will be added before first relevant row. Please parse it accordingly e.g. skip empty lines for csv parsing.

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\&groups=administrators\&filterOrProjectId=project_DEMO

[
  {
    "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" or with query parameter "Apikey=KEY", or with Basic authentication as Apikey:KEY for username:password. Note, KEY has to be obtained from add-on configuration for REST option, using Get Key button in the very bottom.

Examples:

Apikey query parameter in URL: https://timesheet-plugin.herokuapp.com/api/1/exportData.csv?start=2018-10-01&Apikey=T%2F6r47%2FKrnOPGqrtyI3aP%2FKAxnUsJBj7PzdkAqpvl6ijegFscT3pPqWf2pVRWSmL. Note, Apikey needs to be urlencoded (/, + and = replaced with %2F, %2B a %3D).

Basic authentication (with curl):

$ curl -u Apikey:T/6r47/KrnOPGqrtyI3aP/KAxnUsJBj7PzdkAqpvl6ijegFscT3pPqWf2pVRWSmL \
    https://timesheet-plugin.herokuapp.com/api/1/exportData.csv\?start=2018-10-01

Apikey Authorization header (with curl):

$ curl -H "Authorization: Apikey T/6r47/KrnOPGqrtyI3aP/KAxnUsJBj7PzdkAqpvl6ijegFscT3pPqWf2pVRWSmL"  \
    https://timesheet-plugin.herokuapp.com/api/1/exportData.csv\?start=2018-10-01