REST APIs
Time to SLA provides powerful REST APIs to help you view and manage your SLA configurations, calendars, notifiers, work items, and permissions.
Here's an overview of what you can do:
View and manage SLAs
Get a list of all SLAs
Retrieve SLA configuration details by ID
Create a new SLA configuration
Update an existing SLA
Delete an SLA
Clone an SLA from an existing SLA
View and manage SLA notifications and global notifications
Get all SLA notifications for a specific SLA
Retrieve all global notifications defined in TTS
Get a notification configuration using SLA ID and notifier ID
Create a new notification configuration.
Update an existing notification configuration
Delete a notification by SLA ID and notifier ID
View and manage calendars
Get all defined calendars in the plugin
Retrieve specific calendar configuration by ID
Create a new calendar
Update an existing calendar
Delete a calendar by ID
View all work items
Retrieve all SLAs associated with a specific work item by SLA ID
Get SLA details for a work item using the work item ID and SLA ID
Recalculation
Get all recalculation records
Start recalculation using JQL
Abort recalculation
Permissions
View all permissions
Update permissions
Prerequisites
Before you begin using the REST APIs, ensure you meet the following prerequisites:
You must have the necessary permissions to access and manage SLAs, calendars, notifications, or other configurations.
A valid JWT token is required for authorization. Follow the steps below to generate one.
Use Postman or another API testing tool to test and integrate the REST APIs.
For more information, refer to the REST API documentation.
How to create a token
To use the REST APIs, you need a JWT token for authentication. Follow these steps:
Navigate to Settings > API Token.
Click the + New Token button. The token creation dialog opens.
Configure your token:
Name your token.
Select when it'll expire, or check the Never expire box if you want the token to remain active indefinitely.
Determine the level of access that the token will have.
Security note
Avoid using tokens that never expire. If such a token is exposed, it must be deleted manually, as it will not expire automatically.
Click Generate. The JWT Token appears.
Save the JWT Token by clicking the copy button. Note that you won’t be able to access this code after closing the dialog.
Click Cancel after copying the token, and the token will appear on the main page.
Replace {{jwtToken}} in the header with your token.
Important note
Your JWT must have permission and access to use the APIs. For example, even if your JWT token has access to SLA APIs, you cannot utilize them if you do not have permission to view SLA configurations or administer SLAs.
How to grant JWT permission (Using Postman)
Here’s how to set up JWT authorization using Postman:
Click Run in Postman > Postman for Web.
On the Postman main page, click Workspaces > My Workspaces.
Click the plus button to add a new permission.
Copy and paste the link of the token you’ve chosen.
Don't change the link to reflect your own instance. You can only change the parameters (that is, work item ID, SLA ID, etc.).
Click Headers.
Under KEY, enter Authorization.
Under VALUE, enter
Bearer {your token}(replace{your token}with the token you generated).Click Send to authenticate.
Your JWT authorization is now active.
To find a work item ID on Jira Cloud, you can use the following API call:
BASE_URL/rest/api/3/issue/{issueKey} The response will include the work item ID you need for further API requests.
Rest call example
Here’s an example API request with definitions for key parameters in the response:
Example response for “Get Issue SLA of Issue” | Meaning |
|---|---|
| This is the SLA’s goal. |
| This is also related to the SLA goal. We keep this value in milliseconds. |
| If the SLA has started, this will show the start date. We keep this value in a Unix timestamp. If you want to convert it to a human-readable form date, you can use a converter. |
| If the SLA has finished, this will show the end date. We keep this value in a Unix timestamp. If you want to convert it to a human-readable form date, you can use a converter. |
| This is the Target Date. We keep this value in a Unix timestamp. If you want to convert it to a human-readable form date, you can use a converter. |
| Elapsed time is the total time the SLA has taken until this time. |
| The time left until the SLA breaches. |
| The time that has passed since the SLA was breached. |
| The length of time that the SLA has been paused. |
| This value is the same as |