Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,367,490
Community Members
 
Community Events
168
Community Groups

Simple REST endpoint not working

I am trying to perform a REST endpoint with its corresponding web fragment but I am getting the error: script function failed on issue: issue: SF-347, user: mouh, fieldId: __init__, file: <inline script>, edit behaviour: https://itrac-dev.eur.ad.sag/plugins/servlet/scriptrunner/admin/behaviours/edit/8, https://itrac-dev.eur.ad.sag/plugins/servlet/scriptrunner/admin/behaviours/edit/17, https://itrac-dev.eur.ad.sag/plugins/servlet/scriptrunner/admin/behaviours/edit/21

Here is my error log here below:

2022-08-16 20:39:37,512+0200 https-openssl-nio-443-exec-278 ERROR mouh 1239x60320x27 mu7qce 10.248.27.109 /rest/scriptrunner/behaviours/latest/validators.json [c.o.jira.behaviours.BehaviourManagerImpl] Script function failed on issue: issue: SF-347, user: mouh, fieldId: __init__, file: <inline script>, edit behaviour: https://itrac-dev.eur.ad.sag/plugins/servlet/scriptrunner/admin/behaviours/edit/8, https://itrac-dev.eur.ad.sag/plugins/servlet/scriptrunner/admin/behaviours/edit/17, https://itrac-dev.eur.ad.sag/plugins/servlet/scriptrunner/admin/behaviours/edit/21
2022-08-16 20:39:36,371+0200 https-openssl-nio-443-exec-278 WARN mouh 1239x60311x26 mu7qce 10.248.27.109 /browse/SF-347 [c.s.j.p.r.rest.api.MicroDashBoard] getiTracReleaseInfo for user "mouh" took 0 ms
2022-08-16 20:39:36,371+0200 https-openssl-nio-443-exec-278 WARN mouh 1239x60311x26 mu7qce 10.248.27.109 /browse/SF-347 [c.s.j.p.r.rest.api.MicroDashBoard] getiTracReleaseInfo for user "mouh" - "green" -0
2022-08-16 20:39:36,371+0200 https-openssl-nio-443-exec-278 WARN mouh 1239x60311x26 mu7qce 10.248.27.109 /browse/SF-347 [c.s.j.p.r.rest.api.MicroDashBoard] getiTracReleaseInfo for user "mouh" took 0 ms
2022-08-16 20:39:36,371+0200 https-openssl-nio-443-exec-278 WARN mouh 1239x60311x26 mu7qce 10.248.27.109 /browse/SF-347 [c.s.j.p.r.rest.api.MicroDashBoard] getiTracReleaseInfo for user "mouh" - "yellow" -0
2022-08-16 20:39:36,371+0200 https-openssl-nio-443-exec-278 WARN mouh 1239x60311x26 mu7qce 10.248.27.109 /browse/SF-347 [c.s.j.p.r.rest.api.MicroDashBoard] getiTracReleaseInfo for user "mouh" took 0 ms
2022-08-16 20:39:36,371+0200 https-openssl-nio-443-exec-278 WARN mouh 1239x60311x26 mu7qce 10.248.27.109 /browse/SF-347 [c.s.j.p.r.rest.api.MicroDashBoard] getiTracReleaseInfo for user "mouh" - "red" -0

 I don't understand why I have this error my code is super simple. Here is the way in which I have created my web fragment: 

 

This is a screenshot of the custom web item fragment I have created: 

Capture.PNG

 

This is the corresponding REST endpoint I have created: 

Capture.PNG

 

I am specifying the file MounaBulkSummary.groovy to be the one containing the code for the REST endpoint. 

 

Capture2.PNG

Here is the content of the file MounaBulkSummary.groovy

 

import groovy.transform.BaseScript

import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate

import javax.ws.rs.core.MultivaluedMap

import com.atlassian.jira.component.ComponentAccessor

import com.onresolve.scriptrunner.runner.ScriptRunnerImpl

import com.atlassian.sal.api.ApplicationProperties

import com.atlassian.sal.api.UrlMode

import javax.ws.rs.core.Response

import org.apache.log4j.Logger

def log = Logger.warn("atlassian-jira.log")

    log.warn("MOUNA BULK")

@BaseScript CustomEndpointDelegate delegate

MounaBulkSummary(httpMethod: "GET") { MultivaluedMap queryParams ->

    log.warn("MOUNA BULK")

    def user = ComponentAccessor.jiraAuthenticationContext?.loggedInUser

    def issue = ComponentAccessor.getIssueManager().getIssueObject(queryParams.getFirst("issueId") as Long)

    def baseUrl = ScriptRunnerImpl.getOsgiService(ApplicationProperties).getBaseUrl(UrlMode.ABSOLUTE)

    def redirectUrl = "https://secapps.eur.ad.sag:9888/FPIA/?iTrac=${issue.key}&reporter=${user.key}&baseURL=${baseUrl}"

    Response.temporaryRedirect(URI.create(redirectUrl)).build()

}

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events