To learn more about Tempo products, please visit our Help Center. For support, see our Support Portal.

Data Center API - Updating workload schemes using a spreadsheet and the command line with private endpoint



Question

How can I bulk edit the workload schemes of my Tempo team members

Answer

Workload schemes can only be edited one by one from the Tempo UI. In this article we show a simple way with a use of spreadsheet and a command line tool to update the workload schemes for your team members.

In a first step we need a list of all existing Jira users. When you don´t have already an existing list you are able to retrieve a list of all Jira users by using the Jira REST API ({yourJIRAurl}/rest/api/2/user/search?username=.). For large Jira instances you might need to loop through several calls by adding the &startAt= parameter to your url request. Now you should copy your JSON responses and use a converter tool to convert the JSON file to a csv file. In a next step we import the csv file to our spreadsheet and remove those columns that we do not need. For our later operation we only need the Jira username. By now your spreadsheet should look similar to the screenshot below:

Next we add a new column to the spreadsheet where we define the Workload scheme ID of your team member. You can retrieve a full list of workload schemes by going to the Tempo Administration menu and select workload schemes or use the REST API (({yourJIRAurl}/rest/tempo-core/1/workloadscheme). Now we add another column to the sheet and enter a formular to the first cell:
="curl --user ""username:password"" --header ""Content-Type: application/json"" --request PUT --data '{""id"": "&E2&"}' http://localhost:8080/rest/tempo-core/1/workloadscheme/user/"&B2

Where B2 refers to the cell with the username and E2 to the cell with the workload scheme ID. Your spreadsheet should now look like:

Now we copy the curl update commands and paste them into a text Editor of your choice (without the header). Save the file with a ".sh" extension and give the file execution permission. You are ready to go. Open your terminal and run the file you just created with:

sh yourfilename.sh

 All your Team members workload schemes should be updated after running the script file.