Create a Tempo Account Using the REST API


Create a Tempo account (a way to track time across multiple teams and projects) using the Tempo REST API. Utilising the Tempo REST Endpoint, this script uses basic authentication in the headers of the request to authenticate the user. The authenticated user must have permission to create a Tempo account. Read more about permissions in Tempo in this article.


I want to automate the creation of Tempo accounts to save time manually creating them, and make issue progress easy to track. I can use this script to trigger a Tempo account creation each time an Epic is created. Allowing me to track the time spent on issue in that Epic.

Good to Know


Jira Jira (7.3 - 7.13)

import com.atlassian.jira.component.ComponentAccessor

// the user property where the user name and password are stored into
final String userPropertyKey = "jira.basic.auth.creds"

def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def credentials = ComponentAccessor.userPropertyManager.getPropertySet(loggedInUser).getString(userPropertyKey)
def baseUrl = ComponentAccessor.applicationProperties.getString(APKeys.JIRA_BASEURL)

def data = [
    name  : "Account",
    key   : "12345",
    lead  : [
        key     : "admin",
        username: "admin"
    status: "OPEN"

def client = new RESTClient(baseUrl)
    Authorization      : "Basic " + credentials.bytes.encodeBase64().toString(),
    "X-Atlassian-Token": "no-check"

client.handler.success = {
    log.debug "Account successfully created"

client.handler.failure = { HttpResponseDecorator response ->
    log.error response.entity.content.text
    path: new URIBuilder("$baseUrl/rest/tempo-accounts/1/account/"),
    contentType: ContentType.JSON,
    body: data
Discovered an issue? Report it here

Suggested for you

Appears in these Collections