Calling the Rest APIS from jira scriptrunner

farhan_shaik97 May 9, 2023

I want to call the external systems(any other App) API from Jira ScriptRunner using a groovy script.

i ran the script but its throwing errors because of these libraries

import groovy.json.JsonOutput
import groovyx.net.http.ContentType
import groovyx.net.http.HttpResponseDecorator
import groovyx.net.http.RESTClient

 

Errors:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 4: unable to resolve class groovyx.net.http.RESTClient @ line 4, column 1. import groovyx.net.http.RESTClient ^ Script1.groovy: 2: unable to resolve class groovyx.net.http.ContentType @ line 2, column 1. import groovyx.net.http.ContentType ^ Script1.groovy: 3: unable to resolve class groovyx.net.http.HttpResponseDecorator @ line 3, column 1. import groovyx.net.http.HttpResponseDecorator

 

can any one help me on how to get this working is there any way we can upload libraries in script runner which are popping this errors.

 

Thank you.

 

1 answer

0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 9, 2023

ScriptRunner have built-in tools for REST API calls, you don't need to rely on the "groovyx" packages.

See: https://docs.adaptavist.com/sr4jc/latest/best-practices/rest-apis

farhan_shaik97 May 9, 2023

Thanks for the quick reply @Aron Gombas _Midori_

But if I want to connect Jira with workday by using the script runner and calling workday from Jira scriptrunner via APIs. How can i achieve this? can u please help me out with this.

 

Thank you

Pavel Kratky
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 29, 2024

Hello, don't know if it is still valid and if you are on Cloud/Datacenter - but this might help you - there are also examples included: REST API FAQs (adaptavist.com)

Suggest an answer

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

Atlassian Community Events