import groovyx.net.http.RESTClient
import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Level

def issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("SD-3")

def baseURL = ComponentAccessor.getApplicationProperties().getString("jira.baseurl")

String token = 'personal_access_token'

def jiraRestClient = new RESTClient(baseURL)
jiraRestClient.defaultRequestHeaders.Authorization = 'Bearer ' + token

def getResponse = jiraRestClient.get(path: "/rest/sla/1.0/analytics/${issue.getKey()}")

        if (getResponse.status == 200) {
            def data = getResponse.data
            return data
        }


  • No labels