I use post function and scriptrunner to run groovy script when the issue is closed. Initially the script was used with Jira server, I don't know that when I migrate the code to Jira cloud, how could it work. This is the libraries to be used:
@grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1' )
import groovy.grape.Grape
import groovyx.net.http.*
import static groovyx.net.http.ContentType.*
import static groovyx.net.http.Method.*
//== END HTTPBUILDER IMPORTS
import javax.net.ssl.X509TrustManager
import javax.net.ssl.SSLContext
import java.security.cert.X509Certificate
import javax.net.ssl.TrustManager
import java.security.SecureRandom
import org.apache.http.conn.ssl.SSLSocketFactory
import org.apache.http.conn.scheme.Scheme
import org.apache.http.conn.scheme.SchemeRegistry
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.HttpRequest;
import org.apache.http.protocol.HttpContext;
import groovyx.net.http.HTTPBuilder
import org.apache.log4j.Logger
If I want it to work with Jira cloud, which libraries are still compatible with?
Hi Kannpitcha,
I can confirm that in scriptRunner for Jira Cloud we work with Rest APIs only and that it is possible to write scripts that would interact with an external application such as Slack, as long as the application contains a REST API which can be called to interact with it. We have an example in our library script, which you can use as a reference guide when writing a script to make external requests.
In order to achieve this requirement, you should review the REST API documentation for the external application in order to see what REST APIs you will need to use to achieve this. We would advise contacting the third-party applications support team if you have any questions about how their third-party API works.
We have a documentation example located here which shows how you can post a message to Slack and this example may prove a useful reference in helping you to create the script that you require, as it shows an example of making an API call to an external REST API.
Finally, I can confirm Atlassian does not permit our app to access any of the private REST APIs they provide which means we are only allowed to access the public APIs they provide when calling the Jira Cloud API but for external APIs you can call them and can use the steps above to do this.
I hope this information helps.
Regards,
Kristian
When migrating to the cloud, script rewrites are necessary. Visit https://docs.adaptavist.com/sr4jc/latest/scriptrunner-migration/migrate-from-scriptrunner-for-jira-server-to-cloud/rewriting-scripts-for-cloud-hints-and-tips for guidance on modifying your scripts, where you should be able to find compatible libraries and more.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.