Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Send a HTTP POST as a post function.

Hi All,

I am trying to figure out which plugin (if any) can help me solve this business case.

When we transition through a workflow, we would like to have JIRA send a HTTP POST to a different piece of software that triggers some events in our organization. If this remote software returns an error or is non-responsive, the issue should go into a "Needs Attention" state with some field populated by the error. If the POST succedes, the issue will transition to the next step properly.

I do not have the expertise on hand to develop a full-blown plugin. I do see there are two plugins that may help us, Script Runner and JIRA Scripting Suite. Does anyone know if either of those will work for our use case?

Thank you!

1 answer

1 accepted

2 votes
Answer accepted
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.
Jun 09, 2012

There might be ready plugins to post data but i'm not aware of any right now. It can be surely done using the script runner plugin. You will need two post functions provided by this plugin:

1. "Groovy post function" to post data to your backend and set a custom field, e.g. "error" to the error message returned in the http response

2. As the last post function you need a "Fast-track transition issue" post function to transition to your error state when the custom field "error" is set, i.e. when an error has occured

I have no ready code right now but posting to a website using basic authentication is straightfoward and you can find many examples.

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.
Jun 10, 2012

Ok, meanwhile i have got some code for 1) but it is not tested.

import org.apache.commons.httpclient.Credentials
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.UsernamePasswordCredentials
import org.apache.commons.httpclient.auth.AuthScope
import org.apache.commons.httpclient.methods.PostMethod;

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.fields.CustomField

// where to post

// user/password used for access

// if parameters are needed

// custom field containing error

HttpClient client = new HttpClient();
Credentials credentials = new UsernamePasswordCredentials(USER,PASSWORD);
client.getParams().setParameter("http.useragent", "GroovyScripClient");
client.getState().setCredentials(AuthScope.ANY, credentials);

PostMethod method = new PostMethod();
method.addParameter(EXAMPLE1_KEY, EXAMPLE1_VAL);

String error = null
	int returnCode = client.executeMethod(method);
	if (returnCode != HttpStatus.SC_OK) {
		error = method.getResponseBodyAsString();
	} else { // just consume output
} catch (Exception e) {
	error = e.getMessage();
} finally {

CustomFieldManager customFieldManager = ComponentManager.getInstance().getCustomFieldManager()
CustomField cfError = customFieldManager.getCustomFieldObjectByName(CFNAME);
if (cfError != null) {
	issue.setCustomFieldValue(cfError, error)

That's great Dieter! I will try and implement something based on your recommendation and example next week.


I have a scenario where during Workflow transition, I would make JIRA send a HTTP POST to different application which responds with JSON message. If the application returns Success message the workflow would move to next transition(e.g TODO--> IN PROGRESS). If the external application returns an error, the issue should stay in TODO state itself.

How do i make this happen?


I have added groovy post-function, where script fetches issue field values and send to external application. The response received is stored in custom field('ERROR").I am able to achieve this


Now how do i add condition that, if external application returns error message, how to stop the transition happening(e.g. the issue should stay in TODO state itself with error message from external application

Suggest an answer

Log in or Sign up to answer