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.7 - 8.6)

import com.atlassian.jira.component.ComponentAccessor import import import import // the user-defined property where the user name and password are stored into final String userPropertyKey = "jira.meta.basicAuthCreds" 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) client.setHeaders([ Authorization : "Basic ${credentials.bytes.encodeBase64().toString()}", "X-Atlassian-Token": "no-check" ]) client.handler.success = { response, json -> log.debug " Account successfully created" json['id'] } client.handler.failure = { HttpResponseDecorator response -> log.error response.entity.content.text } path: '/rest/tempo-accounts/1/account/', contentType: ContentType.JSON, body: data )
Discovered an issue? Report it here

Suggested for you

Appears in these Collections