JIRA SERVER Api REST vs CLOUD

Eduard Diez
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 13, 2020

Hi community;

 

My enterprise has changed to be working in cloud until February to now work in server, and for me is very different but I know how works the scripts in cloud by the rest api, and to do the cahange ... wow!!! 

I put here a simple code in cloud and I need to understand how I can transform in server

Thanks

Captura.PNG

I put here the code to copy and paste if you need


def projectKey = 'XXXX'
/*
{ "startAt": 0,
"maxResults": 50, no poner más de 100 porque peta por todos lados
"total": 250,
"issues": [] }
*/
def resultx = get('/rest/api/2/search?jql=project='+projectKey+'&maxResults=100&startAt=0')
.header('Content-Type', 'application/json')
.asObject(Map)
if (result.status == 200){
log.warn('Total Issues = ' + result.body.total)
} else {
return "Failed to find issue: Status:"+result.status
}
def links = result.body.issues.fields.issuelinks
def tipo = result.body.issues.fields.issuelinks.outwardIssue.fields.issuetype
return tipo

1 answer

1 accepted

0 votes
Answer accepted
David_Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 18, 2020

It's not entirely clear what you mean. Are you saying that a particular REST API call that works with Jira Cloud doesn't work with Jira Server?

The REST API call:

/rest/api/2/search?jql=project=<key>&maxResults=100&startAt=0

inside your script is completely valid for Jira Server, as per this section of the Jira Server REST API documentation.

Suggest an answer

Log in or Sign up to answer