REST endpoint redirected to error page- Cannot open URL: bundle://200.0:1/rest_CreateMultipleSubtask

Mouna Hammoudi November 7, 2022

I am using a REST endpoint and here is my code: and here are some screenshots 

as you can see I am redirected to an error page after I click on the button. Anyone knows what is wrong?

Capture2.PNGCapture1.PNGCapture.PNG

package CreateMultipleSubtasks

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

import groovy.json.JsonBuilder

import groovy.transform.BaseScript

import com.atlassian.jira.issue.Issue;

import javax.ws.rs.core.MultivaluedMap

import javax.ws.rs.core.Response

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 org.apache.log4j.Logger

import com.atlassian.jira.project.Project

import com.atlassian.jira.bc.project.component.ProjectComponent

import com.atlassian.jira.project.ProjectManager

@BaseScript CustomEndpointDelegate delegate

callSubTaskCreator(httpMethod: "GET", groups: ["jira-users"]) {

MultivaluedMap queryParams, String body ->

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

log.warn("I AM HERE MOUNA 1");

ConfigurationCreateMultipleSubtasks conf = new ConfigurationCreateMultipleSubtasks()

def subTaskCreatorHashMap= conf.getSubTaskCreatorHashMap()

String itracCreatemultiplesubtasksProjectCategoriesURL = subTaskCreatorHashMap["itracCreatemultiplesubtasksProjectCategoriesURL"];

def user = ComponentAccessor.jiraAuthenticationContext?.loggedInUser

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

def itracCreatemultiplesubtasksProjectCategoriesURL2 = itracCreatemultiplesubtasksProjectCategoriesURL.replaceAll(":1:", issue.getKey())

def itracCreatemultiplesubtasksProjectCategoriesURL3 = itracCreatemultiplesubtasksProjectCategoriesURL2.replaceAll(":2:", user.getUsername())

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

 

}

1 answer

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 14, 2022

Hello @Mouna Hammoudi 

Where did you find documentation that told you this was a valid API endpoint? Please provide a link to that documentation.

I see you have posted several questions in the communities. Some you have tagged as Jira Server and others as Jira Cloud. This one is tagged as Jira Cloud. Can you please confirm that you are trying to execute this on a Jira Cloud environment? The URL in your images does not appear to match the standard format for a Jira Cloud environment.

Suggest an answer

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

Atlassian Community Events