Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Include Page
Tempo for Data Center Header
Tempo for Data Center Header
JSON payload
Page Properties

Question

How can I import plans using the Tempo REST API?

Answer

Plans can be imported to Tempo using the REST API. In the example below, we will create an executable script file that can be run on every computer.

1. Create your Excel sheet with the plans that you want to import. Your excel sheet should look similar to this:

Image Removed
Image Added

2. The Tempo REST API uses the JSON format to pass the information to Tempo for import. Use Excel to convert the values into a valid JSON format. According to the sample below:

JSON payload
Code Block
languagetext
themeEclipse
title
{
"description":"Plan on an issue",
"planItemType":"ISSUE",
"planItemId":"11290",
"planApproval":
{"reviewerKey":"john","statusCode":1},
"start":"2021-02-18",
"end":"2021-02-18",
"assigneeKey":"john",
"includeNonWorkingDays":false,
"secondsPerDay":7200,
"startTime":"09:42"
}

The REST API endpoint to be used is:

REST API
Code Block
languagetext
titleREST API
{yourJiraurl}/rest/tempo-planning/1/plan

3.The generated cUrl command should look something similar to:

Code Block
languagebash
curl -D- -u taylor:proxy --request POST --url http://localhost:8080/rest/tempo-planning/1/plan --header 'Content-Type: application/json' --data '{"description":"Plan on an issue","planItemType":"ISSUE","planItemId":"11290","planApproval":{"reviewerKey":"john","statusCode":1},"start":"2021-2-18","end":"2021-2-17","assigneeKey":"stella","includeNonWorkingDays":false,"secondsPerDay":28800,"startTime":"0.375"}"'

4. Copy the generated cURL command lines from excel and copy them to a text file. Add a "sh" extension to the file and make it executable.

Image Removed
Image Added

4. Run the script from your terminal by entering "sh {yourscriptfile}.sh". By adding an output file to your cURL commands you can either check the generated plans or in case the import failed you will see an error message e.g. when you have not the proper permission to plan for the user or other error messages (e..g enddate is before startdate)