Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

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.

For any requests to Jira (which are necessary to update issues) you will need an API token from Atlassian. You can find more information about creating and managing Atlassian API tokens here.

Update the Tempo Account Fields

After a restore of the database on the Cloud instance the Tempo Account and Team field exist but any related data needs to be updated with the newly created Tempo Account and Tempo Team information. 

First we need to get the custom field ID of the Tempo Account or Team fields:

curl --request GET 'https://{JiraCloudUrl}/rest/api/3/field' -H 'Authorization: Basic {base64encodedAtlassianEmail:AtlassianAPIToken}'

Within the response of that call you will find the information of the Tempo Account and the Tempo Team field:

{
        "id": "customfield_10201",
        "key": "io.tempo.jira__account",
        "name": "Account",
And
 {
        "id": "customfield_10200",
        "key": "io.tempo.jira__team",
        "name": "Team",

To update the Jira issue with the new Tempo Account/Team values use the Jira issue endpoint with a PUT request:

curl --request PUT 'https:///{JiraCloudUrl}/rest/api/3/issue/{IssueKey}' \
--H 'Content-Type: application/json' \
--H 'Authorization: Basic {base64encodedAtlassianEmail:AtlassianAPIToken}' \
--data-raw '{"fields": {"customfield_10201": {TempoAccountID}}'

As the update of the Jira custom field only accepts the Tempo Account ID (key or name can not be passed) you will need to find the Tempo Account from the imported Tempo Accounts. The Tempo Accounts are returned from the API call:

curl --request GET 'https://api.tempo.io/core/3/accounts' -H 'Authorization: Bearer {TempoAPIToken}' 

Worklog Account Information

Retrieving the account information can only be done for a single Tempo Account. In order to retrieve all Tempo Accounts you will need to loop through all your accounts.

curl --location --request GET 'https://api.tempo.io/core/3/worklogs/account/{TempoAccountKey}?from={periodStartdate}&to={periodEnddate}' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {TempoAuthorisationToken}' 

The endpoint only accepts the Account key (not Tempo account ID or the Tempo Account name).

  • No labels