Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Rest APIs can help you edit and view your SLA data.

...

titleHere's everything you can do with these APIs:
Panel
panelIconId1f525
panelIcon:fire:
panelIconText🔥
bgColor#DEEBFF

For further information, click here to access the REST APIs documentation.

To use these APIs, you need a JWT token for authorization.

To create a new token:

  1. Go to the API Token page.

  2. Click New Token to create a token.

    Image Removed
  3. Replace {{jwtToken}} in the header with your token.

Panel
panelIconIdatlassian-warning
panelIcon:warning:
panelIconText:warning:
bgColor#FFF0B3

Important note: Keep in mind that your your JWT must have permission and access to use these APIs. For example, even if your JWT token has access to SLA APIs, you cannot utilize them if you do not have authority to view SLA configurations or administer SLAs.

Panel
panelIconId26d4
panelIcon:no_entry:
panelIconText
bgColor#FFEBE6

Setting Permissions

...

Button handy
blankfalse
color#0052CC
nameOn-Prem
linkhttps://appfire.atlassian.net/wiki/spaces/TTS/pages/46662426/REST+Services
width85
Button handy
blankfalse
color#EBECF0
nameCloud
linkhttps://appfire.atlassian.net/wiki/spaces/TTSC/pages/36209134/REST+APIs
width84

Panel
panelIconIdatlassian-info
panelIcon:info:
bgColor#F4F5F7

This page is about Time to SLA for Jira On-Prem. Using Jira Cloud? Click the Cloud button above.

Table of Contents
maxLevel1

Calendar Rest API

Panel
bgColor#DEEBFF

Click here to reach Calendar REST API.

...

Next-Gen SLA Rest API

Panel
bgColor#DEEBFF

Click here to reach Next-Gen SLA REST API.

...

Additional Time to SLA Rest API

Panel
bgColor#DEEBFF

Click here to reach REST API.

Saving SLA definition

Method

POST

URL

/rest/tts-api/latest/sla

Sample Result

{"success":false,"message":"Failed when saving SLA: All fields cannot be empty"}
{"success":true,"message":"35"}

Origin and target dates are custom fields

POST Data


    "description":"Description of the SLA definition",
    "workflowName":"Workflow name",
    "slaStartDateField":10900, // date custom field Id
    "slaEndDateField":10901,

  

   // date custom field Id
    "slaValueAsTimeString":"3h",
    "jqlString":"",
    "calendarId":-1, // -1 for 7x24, or calendarId
    "multipleTransition":true,
    "onlyFirstExecution":false
}

Possible Responses

{"success":true,"message":"34"}
{"success":false,"message":"Failed when saving SLA: At least slaStartDateField or originStatusId should be provided"}

With negotiation time

...


    "description":"Description of the SLA definition",
    "workflowName":"Workflow name",
    "originStatusId":[1],
    "targetStatusId":[6],
    "slaNegotiationDateIssueFieldKey":"duedate",
    "jqlString":"",
    "calendarId":-1, // -1 for 7x24, or calendarId
    "multipleTransition":true,
    "onlyFirstExecution":false
}

Possible Responses

{"success":true,"message":"34"}
{"success":false,"message":"Failed when saving SLA: At least slaStartDateField or originStatusId should be provided"}

With pauses

POST Data


    "description":"Description of the SLA definition",
    "workflowName":"Workflow name",
    "originStatusId":[1],
    "targetStatusId":[6],
    "slaNegotiationDateIssueFieldKey":"duedate",
    "jqlString":"",
    "calendarId":-1, // -1 for 7x24, or calendarId
    "multipleTransition":true,
    "onlyFirstExecution":false,
    "pauseSlaArray":[1,5]
}

Possible Responses

{"success":true,"message":"34"}
{"success":false,"message":"Failed when saving SLA: At least slaStartDateField or originStatusId should be provided"}

...

Bulk saving SLA definitions

Method

POST

URL

/rest/tts-api/latest/sla/bulk

Sample Result

[
  {"success":true,"message":"34"},
  {"success":false,"message":"Failed when saving SLA: At least slaStartDateField or originStatusId should be provided"}
]

An SLA with negotiation time and another one with the custom origin and target dates 

POST Data

[
  {
    "description":"Description of the SLA definition",
    "workflowName":"Workflow name",
    "originStatusId":[1],
    "targetStatusId":[6],
    "slaNegotiationDateIssueFieldKey":"duedate",
    "jqlString":"",
    "calendarId":-1, // -1 for 7x24, or calendarId
    "multipleTransition":true,
    "onlyFirstExecution":false
  },
  {
    "description":"Description of the SLA definition",
    "workflowName":"Workflow name",
    "slaStartDateField":10900, // date custom field Id
    "slaEndDateField":10901,

  

   // date custom field Id
    "slaValueAsTimeString":"3h",
    "jqlString":"",
    "calendarId":-1, // -1 for 7x24, or calendarId
    "multipleTransition":true,
    "onlyFirstExecution":false
  }
]

Possible Responses

[
  {"success":true,"message":"34"},
  {"success":false,"message":"Failed when saving SLA: At least slaStartDateField or originStatusId should be provided"}
]

...

Showing SLA definition

Method

GET

URL

/rest/tts-api/latest/sla/{slaId}

Possible Responses


    "id":

25

 25,
    "description":"Description of the SLA definition",
    "workflowName":"Workflow name",
    "originStatusId":[1],
    "targetStatusId":[6],
    ...
}

...

Searching SLA definition

Method

GET

URL

/rest/tts-api/latest/sla/search

Identifiers for search operation

-description

Example description=Urgent

-workflowName

Example workflowName=TTS Project Workflow

-priorityId

Example priorityId=1

-originStatusId

Example originStatusId=3

-targetStatusId

Example targetStatusId=5

-slaStartDateField

Example slaStartDateField=1

-slaEndDateField

Example slaEndDateField=5

-multipleTransition

Example multipleTransition=true

-onlyFirstExecution

Example onlyFirstExecution=false

-slaValueAsTimeString

Example slaValueAsTimeString=20m

-slaNegotiationDateFieldId

Example slaNegotiationDateFieldId=11000

-slaNegotiationDateIssueFieldKey

Example slaNegotiationDateIssueFieldKey=duedate

-workingTimeId

Example workingTimeId=3

-jqlString

Example jqlString=issuetype = Improvement

Responses for: /rest/tts-api/latest/sla/search

[
    {
       "id":24,
       "description":"Urgent Handle",
       "workflowName":"TTS Project Workflow",
       "priorityId":"1",
       "originStatusId":[1],
       "targetStatusId":[3],
       "slaValueAsTimeString":"20m",
       "jqlString":"",
       "pauseSlaArray":[
  
       ],
       "empty":false
    },
    {
       "id":25,
       "description":"Urgent Fix",
       "workflowName":"TTS Project Workflow",
       "priorityId":"1",
       "originStatusId":[3],
       "targetStatusId":[5],
       "slaValueAsTimeString":"1h",
       "jqlString":"",
       "pauseSlaArray":[
  
       ],
       "empty":false
    },
    {
       "id":28,
       "description":"Trivial Finalize",
       "workflowName":"TTS Project Workflow",
       "priorityId":"5",
       "originStatusId":[1],
       "targetStatusId":[6],
       "slaValueAsTimeString":"1d",
       "jqlString":"",
       "pauseSlaArray":[
          1
       ],
       "empty":false
    },
    {
       "id":26,
       "description":"Normal Resolve",
       "workflowName":"TTS Project Workflow",
       "originStatusId":[1],
       "targetStatusId":[5],
       "slaValueAsTimeString":"4h",
       "workingTimeId":1,
       "jqlString":"priority != Blocker",
       "pauseSlaArray":[
  
       ],
       "empty":false
    },
    {
       "id":30,
       "description":"Multiple Status SLA",
       "workflowName":"TTS Project Workflow",
       "originStatusId":[1,4],
       "targetStatusId":[5,6],
       "slaValueAsTimeString":"10m",
       "jqlString":"issuekey = TP-29",
       "pauseSlaArray":[
  
       ],
       "empty":false
    }
]

Responses for: /rest/tts-api/latest/sla/search?description=Urgent

[
    {
       "id":24,
       "description":"Urgent Handle",
       "workflowName":"TTS Project Workflow",
       "priorityId":"1",
       "originStatusId":[1],
       "targetStatusId":[3],
       "slaValueAsTimeString":"20m",
       "jqlString":"",
       "pauseSlaArray":[
  
       ],
       "empty":false
    },
    {
       "id":25,
       "description":"Urgent Fix",
       "workflowName":"TTS Project Workflow",
       "priorityId":"1",
       "originStatusId":[3],
       "targetStatusId":[5],
       "slaValueAsTimeString":"1h",
       "jqlString":"",
       "pauseSlaArray":[
  
       ],
       "empty":false
    }
]

Responses for: /rest/tts-api/latest/sla/search?description=Urgent&slaValueAsTimeString=20m

[
    {
       "id":24,
       "description":"Urgent Handle",
       "workflowName":"TTS Project Workflow",
       "priorityId":"1",
       "originStatusId":[1],
       "targetStatusId":[3],
       "slaValueAsTimeString":"20m",
       "jqlString":"",
       "pauseSlaArray":[
  
       ],
       "empty":false
    }
]

...

Listing all SLA definitions

Method

GET

URL

/rest/tts-api/latest/sla/allSlas

Possible Response

[
    {
       "id":24,
       "description":"Urgent Handle",
       "workflowName":"TTS Project Workflow",
       "priorityId":"1",
       "originStatusId":[1],
       "targetStatusId":[3],
       "slaValueAsTimeString":"20m",
       "jqlString":"",
       "pauseSlaArray":[
  
       ],
       "empty":false
    },
    {
       "id":25,
       "description":"Urgent Fix",
       "workflowName":"TTS Project Workflow",
       "priorityId":"1",
       "originStatusId":[3],
       "targetStatusId":[5],
       "slaValueAsTimeString":"1h",
       "jqlString":"",
       "pauseSlaArray":[
  
       ],
       "empty":false
    },
    {
       "id":28,
       "description":"Trivial Finalize",
       "workflowName":"TTS Project Workflow",
       "priorityId":"5",
       "originStatusId":[1],
       "targetStatusId":[6],
       "slaValueAsTimeString":"1d",
       "jqlString":"",
       "pauseSlaArray":[
          1
       ],
       "empty":false
    },
    {
       "id":26,
       "description":"Normal Resolve",
       "workflowName":"TTS Project Workflow",
       "originStatusId":[1],
       "targetStatusId":[5],
       "slaValueAsTimeString":"4h",
       "workingTimeId":1,
       "jqlString":"priority != Blocker",
       "pauseSlaArray":[
  
       ],
       "empty":false
    },
    {
       "id":30,
       "description":"Multiple Status SLA",
       "workflowName":"TTS Project Workflow",
       "originStatusId":[1,4],
       "targetStatusId":[5,6],
       "slaValueAsTimeString":"10m",
       "jqlString":"issuekey = TP-29",
       "pauseSlaArray":[
  
       ],
       "empty":false
    }
]

...

Updating SLA definition

Method

POST

URL

/rest/tts-api/latest/sla

POST Data


    "id":

25

 25,

   

    // SLA Id
    "description":"Description of the SLA definition",
    "workflowName":"Workflow name",
    "originStatusId":[1],
    "targetStatusId":[6],
    "slaNegotiationDateIssueFieldKey":"duedate",
    "jqlString":"",
    "workingTimeId":-1, // -1 for 7x24, or workingCalendarId
    "multipleTransition":true,
    "onlyFirstExecution":false
}

Possible Responses

{"success":true,"message":"25"}
{"success":false,"message":"error message!"}

Updating with Pauses


    "id":

25

 25,

   

    // SLA Id
    "description":"Description of the SLA definition",
    "workflowName":"Workflow name",
    "originStatusId":[1],
    "targetStatusId":[6],
    "slaNegotiationDateIssueFieldKey":"duedate",
    "jqlString":"",
    "workingTimeId":-1, // -1 for 7x24, or workingCalendarId
    "multipleTransition":true,
    "onlyFirstExecution":false,
    "pauseSlaArray":[5,100]
}

Possible Responses

{"success":true,"message":"25"}
{"success":false,"message":"Status validation error. [100] no such status."}

...

Deleting SLA definition

Method

DELETE

URL

/rest/tts-api/latest/sla/{slaId}

Possible Responses

{"success":true,"message":"Deleted slaId with 25"}

...

Get SLA details for an issue

Method

GET

URL

/rest/tts-api/1.0/sla/issue/{issue-key}

Possible query parameters

-slaId

Example slaId=26

Error Response

{"message":"Issue with given key "TTS-235" could not be found."}

SLA ID is given

{
"paused":

false

 false,
"endDate": "2017-11-03T10:35:22Z",
"slaTargetSourceName": "Resolved",
"inNonWorkingDays":

false

 false,
"notMuchTime":

80

 80,
"formattedWorkingDuration": "1d 1h 35m 22s",
"formattedRemainingDuration": "6h 24m 38s",
"slaStatus": "SUCCESS",
"synchronizing":

false

 false,
"remainingDuration": "PT22H24M38S",
"elapsedPercentage":

53

 53,
"class": "class com.tuncaysenturk.jira.plugins.dto.IssueSlaDetailsDto",
"slaValue": "PT48H",
"slaOriginSourceName": "Open",
"inNonWorkingHours":

false

 false,
"slaName": "Resolution Time",
"workingDuration": "PT25H35M22S",
"slaId":

0

 0,
"targetDate": "2017-12-02T09:30:00Z",
"slaValueType": "SLA_VALUE",
"started":

true

 true,
"finished":

false

 false,
"workingCalendarName": "8-5 Business Hours",
"slaOriginType": "STATUS",
"inCriticalZone":

true

 true,
"slaValueSourceName": "SLA Value",
"slaTargetType": "STATUS",
"startDate": "2017-10-02T09:30:00Z",
"slaValueAsDurationString": "2d"
}

No SLA ID is given

[
  {
    "paused":

false

 false,
    "endDate": "2017-11-03T10:35:22Z",
    "slaTargetSourceName": "Resolved",
    "inNonWorkingDays":

false

 false,
    "notMuchTime":

80

 80,
    "formattedWorkingDuration": "1d 1h 35m 22s",
    "formattedRemainingDuration": "6h 24m 38s",
    "slaStatus": "SUCCESS",
    "synchronizing":

false

 false,
    "remainingDuration": "PT22H24M38S",
    "elapsedPercentage":

53

 53,
    "class": "class com.tuncaysenturk.jira.plugins.dto.IssueSlaDetailsDto",
    "slaValue": "PT48H",
    "slaOriginSourceName": "Open",
    "inNonWorkingHours":

false

 false,
    "slaName": "Resolution Time",
    "workingDuration": "PT25H35M22S",
    "slaId":

0

 0,
    "targetDate": "2017-12-02T09:30:00Z",
    "slaValueType": "SLA_VALUE",
    "started":

true

 true,
    "finished":

false

 false,
    "workingCalendarName": "8-5 Business Hours",
    "slaOriginType": "STATUS",
    "inCriticalZone":

true

 true,
    "slaValueSourceName": "SLA Value",
    "slaTargetType": "STATUS",
    "startDate": "2017-10-02T09:30:00Z",
    "slaValueAsDurationString": "2d"
  },
  {
    "paused":

false

 false,
    "endDate": "2017-12-03T10:35:22Z",
    "formattedOverdueDuration": "1d 1h 35m 22s",
    "slaTargetSourceName": "Resolved",
    "inNonWorkingDays":

false

 false,
    "notMuchTime":

80

 80,
    "formattedWorkingDuration": "2d 1h 35m 22s",
    "slaStatus": "EXCEED",
    "synchronizing":

false

 false,
    "elapsedPercentage":

100

 100,
    "class": "class com.tuncaysenturk.jira.plugins.dto.IssueSlaDetailsDto",
    "slaValue": "PT48H",
    "slaOriginSourceName": "Open",
    "inNonWorkingHours":

false

 false,
    "slaName": "Resolution Time",
    "workingDuration": "PT49H35M22S",
    "slaId":

0

 0,
    "overdueDuration": "PT1H35M22S",
    "targetDate": "2017-12-02T09:30:00Z",
    "slaValueType": "SLA_VALUE",
    "started":

true

 true,
    "finished":

false

 false,
    "workingCalendarName": "8-5 Business Hours",
    "slaOriginType": "STATUS",
    "inCriticalZone":

true

 true,
    "slaValueSourceName": "SLA Value",
    "slaTargetType": "STATUS",
    "startDate": "2017-10-02T09:30:00Z",
    "slaValueAsDurationString": "2d"
  }
]

...

Get SLA details for issues based on JQL

Method

GET

URL

/rest/tts-api/1.0/sla/issue/

Possible query parameters

-slaId

[Optional] sla filtering

parameter

parameter Example slaId=26

-jql

Jql to filter issues that you want to get SLA details. Example

jql

 jql=key in (ABC-34,ABC-35)

-index

the index of a result whose page you want the pager to start at

-max

the maximum number of results in a page (cannot be greater than 100)

Response

Warning

Attention

For performance and memory issues, we support pagination. Max 100 issues are returned for a single page, but you can navigate with the parameters returned from REST.

Result

{
    "totalIssues":

49

 49,
    "pagesCount":

5

 5,
    "start":

0

 0,
    "niceStart":

1

 1,
    "end":

10

 10,
    "nextStart":

10

 10,
    "previousStart":

0

 0,
    "slas": [
        {
            ....// same REST response as above service
        },
        {
            ....// same REST response as above service
        }
    ]
}

...

Get 'Time to SLA' field for the issue

Method

GET

URL

/rest/tts-api/1.0/sla/timeToSla/{issue-key}

Possible Responses

success":false,"message":"Issue not exists: TTS-313"}

Possible Responses

[
     {
          "slaId":

25

 25,
          "slaName": "Urgent Fix",
          "originStatusName": "In Progress",
          "targetStatusName": "Resolved",
          "slaValue":

60

 60,
          "slaValueAsString": "1h",
          "statusDate":

1431931844500

 1431931844500,
          "targetDate":

1431935444500

 1431935444500,
          "overdue": "(SLA Overdue) 3 hours, 55 minutes, 51 seconds"
     }
]

...

Get 'SLA Overview' data for the issue

Method

GET

URL

/rest/tts-api/latest/sla/overview/{issue-key}

Possible Responses

[
    {
        "timePerformed":1457004154795,
        "workingDuration":"46 minutes, 10 seconds",
        "workingDurationAsSeconds":2770,
        "pausedDuration":"0",
        "slaValueAsTimeString":"20m",
        "status":"EXCEED",
        "breachString":"26 minutes, 10 seconds",
        "originDate":1457004154795,
        "statusDate":1457004154795,
        "expectedTargetDate":1457005354795,
        "actualTargetDate":1431954304511,
        "slaName":"Urgent Handle"
    },
    {
        "timePerformed":1457004154795,
        "workingDuration":"46 minutes, 10 seconds",
        "workingDurationAsSeconds":2770,
        "pausedDuration":"0",
        "slaValueAsTimeString":"1h",
        "status":"STILL",
        "originDate":1457004154795,
        "statusDate":1457004154795,
        "expectedTargetDate":1457007754795,
        "actualTargetDate":1431954357960,
        "slaName":"Urgent Fix"
    }
]

...

Generating SLA data for existing issues

Method

GET

URL

/rest/tts-api/latest/sla/regenerate/{issue-key}

Possible Responses

{"success":false,"message":"Issue not exists: TTS-313"}
{"success":false,"message":"Unauthorized user"}
{"success":true,"message":""}

...

Resetting SLA

Method

POST

URL

/rest/tts-api/latest/sla/reset/{issue-id}/{sla-id}

POST form param

"date=timeAsMillis"

 

  (as long, time millis, optional, if not set current time will be used)

{issue-id} required parameter where {sla-id} is optional. If {sla-id} is not provided, then all SLAs for the issue will be reset.

Possible Responses

{"success":true,"message":""}
{"success":true,"message":"There are no generated SLA data for issue: TTS-313"}
{"success":false,"message":"Unauthorized user"}
{"success":false,"message":"Issue not exists: TTS-313"}

...

Get SLA History

Method

GET

URL

{{baseUrl}}/rest/tts-api/1.0/sla-history-new?issueId=10400&slaId=339