Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Jira data center issue details from scriptrunner jira cloud

Chamdarig Dall June 3, 2025

Hi Team, 

is it possible to get some details of issues on Jira data center running groovy script on Jira cloud instance?

 

 

2 answers

2 accepted

2 votes
Answer accepted
Kristian Walker _Adaptavist_
Community Champion
June 3, 2025

Hi Chamadri,

It is possible to achieve this requirement with ScriptRunner for Jira Cloud.

I don't have an example script on how to do this, but you will need to use the Jira Data Center rest APIs and call these from your script. 

You would need to use the Get Issue for Key API and call this from within ScriptRunner for Jira Cloud, providing credentials to authenticate with the data centre instance. 

ScriptRunner for Jira Cloud uses Unirest to make rest API calls and you can see an example request for calling an external API here to give an example of the structure to use. 

Hope this helps.

Regards,

Kristian

1 vote
Answer accepted
jiraestro June 3, 2025

This simple script should be helpful :)

import groovy.json.JsonSlurper
import java.net.HttpURLConnection
import java.net.URL

// Jira Data Center URL
def jiraUrl = "<https://your-jira-data-center-instance.com>"

// Endpoint you want to connect to
def apiEndpoint = "/rest/api/2/issue/CRE-12345"

// Construct full URL
def fullUrl = new URL(jiraUrl + apiEndpoint)

// Set up connection
def connection = (HttpURLConnection) fullUrl.openConnection()
connection.setRequestMethod("GET")
// connection.setRequestProperty("Authorization", "Basic " + "YOUR_BASE64_ENCODED_AUTH_STRING")
// Alternatively, use an API token
connection.setRequestProperty("Authorization", "Bearer YOUR_API_TOKEN")

// Execute the request
def responseCode = connection.getResponseCode()
println "Response Code : $responseCode"

if(responseCode == HttpURLConnection.HTTP_OK) {
def response = new JsonSlurper().parse(new InputStreamReader(connection.getInputStream()))
println "Response: $response"
} else {
println "Failed to connect: $responseCode"
}

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events