REST Services

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

Calendar Rest API


Next-Gen SLA Rest API


Additional Time to SLA Rest API

Saving SLA definition

Method

POST

URL

/rest/tts-api/latest/sla

Sample Result

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

 

 


    "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

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

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

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

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

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

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

Possible Responses


    "id": 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

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

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

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

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

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

POST Data


    "id": 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

Possible Responses

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

Updating with Pauses

Updating with Pauses


    "id": 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

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

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

Possible query parameters

-slaId

Example slaId=26

Error Response

Error Response

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

SLA ID is given

SLA ID is given

{
"paused": false,
"endDate": "2017-11-03T10:35:22Z",
"slaTargetSourceName": "Resolved",
"inNonWorkingDays": false,
"notMuchTime": 80,
"formattedWorkingDuration": "1d 1h 35m 22s",
"formattedRemainingDuration": "6h 24m 38s",
"slaStatus": "SUCCESS",
"synchronizing": false,
"remainingDuration": "PT22H24M38S",
"elapsedPercentage": 53,
"class": "class com.tuncaysenturk.jira.plugins.dto.IssueSlaDetailsDto",
"slaValue": "PT48H",
"slaOriginSourceName": "Open",
"inNonWorkingHours": false,
"slaName": "Resolution Time",
"workingDuration": "PT25H35M22S",
"slaId": 0,
"targetDate": "2017-12-02T09:30:00Z",
"slaValueType": "SLA_VALUE",
"started": true,
"finished": false,
"workingCalendarName": "8-5 Business Hours",
"slaOriginType": "STATUS",
"inCriticalZone": true,
"slaValueSourceName": "SLA Value",
"slaTargetType": "STATUS",
"startDate": "2017-10-02T09:30:00Z",
"slaValueAsDurationString": "2d"
}

No SLA ID is given

No SLA ID is given

[
  {
    "paused": false,
    "endDate": "2017-11-03T10:35:22Z",
    "slaTargetSourceName": "Resolved",
    "inNonWorkingDays": false,
    "notMuchTime": 80,
    "formattedWorkingDuration": "1d 1h 35m 22s",
    "formattedRemainingDuration": "6h 24m 38s",
    "slaStatus": "SUCCESS",
    "synchronizing": false,
    "remainingDuration": "PT22H24M38S",
    "elapsedPercentage": 53,
    "class": "class com.tuncaysenturk.jira.plugins.dto.IssueSlaDetailsDto",
    "slaValue": "PT48H",
    "slaOriginSourceName": "Open",
    "inNonWorkingHours": false,
    "slaName": "Resolution Time",
    "workingDuration": "PT25H35M22S",
    "slaId": 0,
    "targetDate": "2017-12-02T09:30:00Z",
    "slaValueType": "SLA_VALUE",
    "started": true,
    "finished": false,
    "workingCalendarName": "8-5 Business Hours",
    "slaOriginType": "STATUS",
    "inCriticalZone": true,
    "slaValueSourceName": "SLA Value",
    "slaTargetType": "STATUS",
    "startDate": "2017-10-02T09:30:00Z",
    "slaValueAsDurationString": "2d"
  },
  {
    "paused": false,
    "endDate": "2017-12-03T10:35:22Z",
    "formattedOverdueDuration": "1d 1h 35m 22s",
    "slaTargetSourceName": "Resolved",
    "inNonWorkingDays": false,
    "notMuchTime": 80,
    "formattedWorkingDuration": "2d 1h 35m 22s",
    "slaStatus": "EXCEED",
    "synchronizing": false,
    "elapsedPercentage": 100,
    "class": "class com.tuncaysenturk.jira.plugins.dto.IssueSlaDetailsDto",
    "slaValue": "PT48H",
    "slaOriginSourceName": "Open",
    "inNonWorkingHours": false,
    "slaName": "Resolution Time",
    "workingDuration": "PT49H35M22S",
    "slaId": 0,
    "overdueDuration": "PT1H35M22S",
    "targetDate": "2017-12-02T09:30:00Z",
    "slaValueType": "SLA_VALUE",
    "started": true,
    "finished": false,
    "workingCalendarName": "8-5 Business Hours",
    "slaOriginType": "STATUS",
    "inCriticalZone": 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

Possible query parameters

-slaId

[Optional] sla filtering parameter Example slaId=26

-jql

Jql to filter issues that you want to get SLA details. Example 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

Result

Result

{
    "totalIssues": 49,
    "pagesCount": 5,
    "start": 0,
    "niceStart": 1,
    "end": 10,
    "nextStart": 10,
    "previousStart": 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

Possible Responses

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

Possible Responses

Possible Responses

[
     {
          "slaId": 25,
          "slaName": "Urgent Fix",
          "originStatusName": "In Progress",
          "targetStatusName": "Resolved",
          "slaValue": 60,
          "slaValueAsString": "1h",
          "statusDate": 1431931844500,
          "targetDate": 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

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

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

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