Forums

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

Calling external rest apis (azure devops) from JIRA cloud

jawad haider September 15, 2020

Dear All,

 

I would like to call external rest api of azure devops from JIRA cloud.For example to create release from JIRA cloud workflow in azure devops

 

I am trying to use scriptrunner groovy script for this and using httpclient for this but unable to find this package on JIRA cloud

 

Can you please advice and suggest is it technical possible to call external rest apis from JIRA cloud ?

 

Thank you

Jawad Haider

1 answer

1 vote
Kristian Walker (Adaptavist)
Community Champion
September 16, 2020

Hi Jawad,

Thank you for your question.

I can confirm that that is possible to interact with external applications with ScriptRunner for Jira Cloud as long as the third party application has a Rest API which can be called from ScriptRunner for Jira Cloud.

We have created a Knowledge base article located here which explains in further detail what process should be used to interact with a third party application using ScriptRunner for Jira Cloud.

I hope this information helps.

Regards,

Kristian

jawad haider September 16, 2020

I am trying to do this in console

 

@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1')
import grooxyx.net.http.HTTPBuilder

 

But getting error :

org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoClassDefFoundError: org/apache/ivy/plugins/resolver/DependencyResolver

jawad haider September 16, 2020

Do you have any example how to call external rest api through groovy script in scriptrunner?

Kristian Walker (Adaptavist)
Community Champion
September 16, 2020

Hi Jawad,

 

Thank you for your response.

Please note the KB article linked contains a link to the sample here which shows how to post a message to slack.

Also please note ScriptRunner uses UniRest so your Rest API call will need to be in this structure and as mentioned in the KB article you will need to contact the vendor of the third party application to ask them to advise on how to call their application.

Regards,

Kristian.

jawad haider September 16, 2020

okay thanks let me try 

jawad haider September 16, 2020

Getting this error now

 

RunResultLogsorg.codehaus.groovy.runtime.InvokerInvocationException: Assertion failed: postToSlack. Values: postToSlack = null at ConsoleScriptExecution1_groovyProxy.run(Unknown Source) Caused by: Assertion failed: postToSlack. Values: postToSlack = null

Kristian Walker (Adaptavist)
Community Champion
September 16, 2020

Hi Jawad,

When using the slack example can you please confirm you have created a Slack API token as mentioned in the documentation and referenced this in the header for the postToSlack rest API call as this will be required to access the Slack API's.

Also can you confirm that you have configured valid values in the channelName, userName and issueKey variables.

The examples, in the documentation have been fully tested and we can confirm these work if you configure the script as mentioned in the documentation page.

Regards,

Kristian

Suggest an answer

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

Atlassian Community Events