Is there any way to reopen a ticket automatically through service

Kanishk Choraria September 11, 2012

I can create n external service from JIRA which will call my api and with some response from that API. This service will be called on closed tickets only, which i will manage.

My concern is that, can we automatically change the status of ticket(s) to reopen if response from API is false (assuming response as true/false as of now).

Kindly suggest.

1 answer

0 votes
Thomas Heidenreich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2012

If there is a workflow transition to reopen the issue, you can trigger that via the API in the case you receive a false response.

Kanishk Choraria September 12, 2012

Thanks Thomas,

But can you be please more elaboraive , that how should i tigger that..?

Thomas Heidenreich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 12, 2012

Here is some PHP code:

if ( ! $yourResponse ){
    $jiraAPI->progressWorkflowAction($auth, $issueKey, "71", array() );
}
  • $yourResponse is the mentioned response on which you want to act when it's false
  • 71 is the workFlow actionid for the reopen step
  • array() is an associative array of fields to be set during the transition

Hope this is better helps

Thomas

Kanishk Choraria September 12, 2012

Thanks Thomas,

This is really helpful. but it would be great if i can get to know the exact JIRA API and function to use, where i can found similar type of code which you had implemented.

I hope i am clear to you.

Thomas Heidenreich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 12, 2012

You could for example use the JiraSoapService from http://docs.atlassian.com/rpc-jira-plugin/latest/index.html?com/atlassian/jira/rpc/soap/JiraSoapService.html

(this is what we use at the moment as we havent switched to REST)

A simple somplete example class to use would be:

class OurJiraSoapHelper
{
	private $soap;
	private $auth;
	
	const JIRA_SERVER 	= 'example.com';
	const JIRA_PORT 	= '8080';
	const JIRA_WSDL 	= '/rpc/soap/jirasoapservice-v2?wsdl';
	
	public function __construct($user, $password){
		$this->soap = new SoapClient ("http://" . self::JIRA_SERVER . ":" . 
self::JIRA_PORT . self::JIRA_WSDL, array ("style" => SOAP_RPC,"
use" => SOAP_ENCODED,"soap_version" => SOAP_1_1,"uri" => "urn:myWS")); $this->auth = $this->soap->login($user, $password); } public function issueReopen($issueKey){ $this->soap->progressWorkflowAction($this->auth, $issueKey, "71", array() ); } }

(Provided that 71 is your action ID to reopen an issue)

Suggest an answer

Log in or Sign up to answer