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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Connection refused when trying to send POST request

I use script-runner to send POST request in the server (http://localhost:5001), but I get "Connection refused". When i tried send it another( server it worked perfectly, but don't know why it doesn't work in this server? Maybe the problem in the port??? Any suggestions will be great. Here is my groovy script:


import org.apache.log4j.Logger
import org.apache.log4j.Level
import groovy.json.JsonSlurper;
import groovy.json.StreamingJsonBuilder;
import org.apache.commons.codec.binary.Base64;

def log = Logger.getLogger("com.acme.CreateSubtask")


def body_req = [
"command" : [
"gdp", "list", "test/p2"

//def baseURL = "";

def baseURL = "http://localhost:5001";

URL url;

url = new URL(baseURL);

HttpURLConnection connection = url.openConnection() as HttpURLConnection;
connection.requestMethod = "POST"
connection.doOutput = true
connection.setRequestProperty("Content-Type", "application/json")
connection.outputStream.withWriter("UTF-8") { new StreamingJsonBuilder(it, body_req) }
connection.connect();"json_body="+body_req+" URL="+url+" Status="+connection.getResponseCode() as String)

0 answers

Suggest an answer

Log in or Sign up to answer
Site Admin
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

620 views 7 23
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you