Tempo for Jira Cloud

REST APIs for Jira Server

Abstract

REST APIs to use when migrating Tempo data from Jira Server

Note

The code examples provided below are for curl and you will need to adapt them to your preferred means of dealing with REST APIs. All information provided in curly brackets “{}” need to be replaced with the variables from your instance.

Teams

Besides the basic information for a Tempo team, you will also need to fetch all related team information such as team members and permissions. To get all teams set up on your Jira Server instance call:

curl --request GET 'http://{youJiraUrl}/rest/tempo-teams/2/team' -H 'Authorization: Basic {username:passwordBase64encoded}'

In the JSON response you will get the IDs of all teams within your Jira instance. The ID is needed for all further calls to retrieve the team members and the permission roles of your teams.

You get all team memberships with a POST call to the /rest/tempo-teams/2/team/members endpoint.

curl --request POST 'http://{youJiraUrl}/rest/tempo-teams/2/team/members' \-H 'Content-Type: application/json' \-H 'Authorization: Basic {username:passwordBase64encoded}' \--data-raw '{"ids": ["4","22","6"],"onlyActive": true}'

Each single entry of a team member object will include a reference to the Tempo team the team member belongs to (e.g. "teamId": 6).

For the permission set of a Tempo team use the endpoint:

curl --request GET 'http://{youJiraUrl}/rest/tempo-teams/2/permissionGroups/team/{TeampoTeamid}' -H 'Authorization: Basic {username:passwordBase64encoded}'

Each team can have multiple permission groups and each permission group has a set of predefined permissions:

"permissions.plan.view": true,
"permissions.plan.manage": true,
"permissions.plan.approve": true,
"permissions.worklog.manage": true,
"permissions.worklog.view": true,
"permissions.worklog.approve": true,
"permissions.team.manage": true

Team permissions are the same on Tempo for Cloud but cannot be imported by a REST endpoint.

If you wish to migrate Tempo teams programmatically you will need to export the Tempo teams roles as well. The roles are returned from the endpoint:

curl --request GET http://{youJiraUrl}/rest/tempo-teams/2/role -H 'Authorization: Basic {username:passwordBase64encoded}'

The default team role will be applied to team members that are added to a team from a Jira group.

Workload and Holiday Schemes

To export workload schemes use:

curl --request GET 'http://{youJiraUrl}/rest/tempo-core/1/workloadscheme' -H 'Authorization: Basic {username:passwordBase64encoded}'

You will need to get the user assignments to the workload schemes by looping through all existing workload schemes:

curl --request GET 'http://{youJiraUrl}/rest/tempo-core/1/workloadscheme/users/{WorkloadSchemeID}' -H 'Authorization: Basic {username:passwordBase64encoded}'

To export holiday schemes, use a similar approach but replace “workloadscheme” with “holidayscheme”:

curl --request GET 'http://{youJiraUrl}/rest/tempo-core/1/holidayscheme' -H 'Authorization: Basic {username:passwordBase64encoded}'

And to get the members of the holiday schemes use:

curl --request GET 'http://{youJiraUrl}/rest/tempo-core/1/holidayscheme/{HolidaySchemeID}/members' -H 'Authorization: Basic {username:passwordBase64encoded}'

Each user can only be assigned to one workload and one holiday scheme. Assigning a user to a holiday scheme will unassign the user from the previous holiday scheme.

Timesheet Approvals

All timesheets of Timesheet users can have three different statuses: “Ready to submit”, “Waiting for approval” and “Approved”. A declined timesheet gets back to the status “Ready to submit”. Timesheets of users and their status can only be retrieved from an REST API endpoint. Timesheets are queried for one team and one period at once. In order to get all timesheets for all users you will need to loop through all teams and all time periods.

The endpoint to use for this is:

curl --request GET 'http://{youJiraUrl}/rest/tempo-timesheets/4/timesheet-approval?teamId=21&periodStartDate=2019-12-08' -H 'Content-Type: application/json' -H 'Authorization: Basic {username:passwordBase64encoded}'

A list of available/existing periods can be retrieved by calling: 

curl --request GET 'http://{youJiraUrl}/rest/tempo-timesheets/5/period/approval?dateFrom=2019-01-06&dateTo=2019-12-12' -H 'Content-Type: application/json' -H 'Authorization: Basic {username:passwordBase64encoded}'

The Timesheet history from a user can be extracted from the endpoint:

curl --request GET 'http://{youJiraUrl}/rest/tempo-timesheets/4/timesheet-approval/user/{UserKey}/log?from={PeriodStartDate}' -H 'Content-Type: application/json' -H 'Authorization: Basic {username:passwordBase64encoded}'

Please note that the Timesheet history can't be imported directly into the Cloud instance. You have the option to do all Timesheet actions (submit, reject, approve) from an REST endpoint but the effective date will always be the date you make the REST call. The historic date of the timesheet log cannot be preserved.