Knowledge Base Articles

Best Practices for Tempo Cloud REST API

Follow these instructions before you pull massive data into any 3rd party apps, such as eazyBI or PowerBI, either from Cloud to Cloud or Cloud to Data Center.

📘 Instructions

Currently, the Tempo API gateway has a rate limit of 5 requests per second per IP address, regardless of the connection types: Application access, user token, or OAuth2 connection. The largest dataset stored in Tempo is from worklogs. The number of results returned is based on your REST call parameters, so try to avoid getting months of worklogs in one single call. Instead, it's recommended to write a script to loop through user/work item/week with pagination for better network traffic and server performance. You can narrow down your query with the following parameters:

  1. Use a shorter time frame, such as by day or by week (instead of by month)

  2. Use a single user (instead of teams)

  3. Use pagination

  4. Use a limit (default: 50, maximum: 5000)

Example response from the worklogs endpoint (shortened). Follow the next link until it is no longer present to retrieve all pages:

JSON
{
  "self": "https://api.tempo.io/4/worklogs?offset=50&limit=50",
  "metadata": {
    "count": 50,
    "offset": 50,
    "limit": 50,
    "next": "https://api.tempo.io/4/worklogs?offset=100&limit=50",
    "previous": "https://api.tempo.io/4/worklogs?offset=0&limit=50"
  },
  "results": [
    { ... }
  ]
}

Do’s and Don’ts:

  1. Test out your script to make sure there are no errors.

  2. Monitor your usage for timeouts (1 second or more) and retries (maximum 3 times).

  3. Have no more than 5 requests per second

  4. Max 3 batches of 5r/s running in parallel (5r/s * 3 = 15r/s) by memory zone of 10mb

  5. Wait at least 1000ms between each request.

API error codes and retry recommendation

ERROR CODE

MEANING

RECOMMENDATION

4xx

Client side error

Do not retry; you need to fix the problem in the code

429

Too many requests

Retry after at least 1 second; avoid bursts of requests

5xx

Error on server side

Retry 3 times with 5-, 10-, and 15-second pauses between retries

If you fail to follow these recommendations and cause traffic overload on the Tempo API server, Tempo will take the drastic measure of blocking your IP from accessing the API server. In this case, please contact Tempo Support for further assistance.

429 errors caused by Jira (Atlassian) rate limits

Some write requests, such as creating worklogs, make Tempo write to Jira. If Jira’s API rate limits are hit at that moment, the request can fail with a 429 and the message “We had a problem trying to communicate with Atlassian. Please try again later.” This is separate from the Tempo gateway limit described above.

Atlassian applies several independent limits, including a per-second burst limit and a per-issue write limit. The response may not include a Retry-After header.

What to do: Retry with exponential backoff and jitter. If you create many worklogs on the same issue, space those writes out. If the error persists, contact Tempo Support with the time of the request and the Tempo-Request-Id header from the response.

See Atlassian’s documentation: Jira Cloud rate limiting

Authentication: personal API tokens and OAuth tokens

A personal API token acts as the user who created it. An OAuth access token acts as the user who authorized the app, and each authorizing user receives their own token.

Symptom: A call returns 403 "User does not have permission" with an OAuth token, but the same call works with a personal API token.

Cause: The permissions checked are those of the user who authorized the OAuth app. That user may lack the permission the endpoint needs, for example Approve Timesheets for a team when calling the timesheet approvals endpoint.

Resolution: Grant the authorizing user the required permission, or authorize the app with a user who already has it.

See also