Skip to main content
Skip table of contents

Import plans using the Tempo REST API on Data Center

This article is for Tempo for Data Center.

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:

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
TEXT
{
"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
TEXT
{yourJiraurl}/rest/tempo-planning/1/plan

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

BASH
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.

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)

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.