You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello,
I am trying to get pull requests information with this
https://vulcan.stepstone.com/rest/dev-status/1.0/issue/detail?issueId=xxx&applicationType=stash&dataType=pullrequest where xxx is issue id :) and it works great but when i try to use it in my groovy code i get "Not Found" and don't know why :( can somebody help me with that?
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.component.ComponentAccessor
import com.opensymphony.workflow.WorkflowContext
import com.atlassian.jira.workflow.WorkflowTransitionUtil;
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl;
import com.atlassian.jira.util.JiraUtils;
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import groovyx.net.http.HTTPBuilder
import net.sf.json.JSONArray
import groovyx.net.*
import groovyx.net.http.*
import com.opensymphony.workflow.InvalidInputException
import groovyx.net.http.Method
import groovyx.net.http.RESTClient
//Managers
def issueManager = ComponentAccessor.getIssueManager()
def iLinkManager = ComponentAccessor.getComponent(IssueLinkManager)
def cfManager = ComponentAccessor.getComponent(CustomFieldManager)
def VULCAN_URL = "your jira adres"
def VULCAN_API_URL = VULCAN_URL + "rest/dev-status/1.0/issue/"
def jira = new HTTPBuilder(VULCAN_API_URL)
jira.setHeaders([Authorization: "Basic ${"login:password".bytes.encodeBase64().toString()}"])
def pullRequest
pullRequest = jira.get(path:'detail?issueId=406152&applicationType=stash&dataType=pullrequest')
return pullRequest
I get this error
groovyx.net.http.HttpResponseException: Not Found at groovyx.net.http.HTTPBuilder.defaultFailureHandler(HTTPBuilder.java:651) at groovyx.net.http.HTTPBuilder$1.handleResponse(HTTPBuilder.java:503) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:222) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164) at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:515) at groovyx.net.http.HTTPBuilder.get(HTTPBuilder.java:285) at groovyx.net.http.HTTPBuilder.get(HTTPBuilder.java:255) at groovyx.net.http.HTTPBuilder$get$0.call(Unknown Source) at Script354.run(Script354.groovy:33)
Hi!
Have you use for work with json these package
import groovy.json.JsonSlurper; import groovy.json.StreamingJsonBuilder;
And for connection do like this
def baseURL = VULCAN_API_URL; URL url = new URL(baseURL);
URLConnection connection = url.openConnection();
connection.requestMethod = "POST"
connection.doOutput = true
connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8")
connection.outputStream.withWriter("UTF-8") { new StreamingJsonBuilder(it, body_req) }
connection.connect();
Hope you have been found solution also
Cheers,
Gonchik Tsymzhitov
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.