411 error while trying to POST to an api

Vineela Durbha April 23, 2019

I am using below code to update fields using api

def baseUrl = new URL("http://xxxx/xxxxxxx/abc");

HttpURLConnection conn= (HttpURLConnection) baseUrl.openConnection();
conn.setInstanceFollowRedirects( false );

conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
conn.setRequestProperty("Accept", "application/json");

log.debug(conn.getResponseCode() as String)


But I am receiving 411 error , not sure on how to set content length.can someone help me with this

2 answers

0 votes
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 12, 2024

Try to use "Customer Data" from "JIRA Automation"

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 24, 2019


I'm not sure how exactly you're getting this error.  Is this Jira Cloud or Jira Server?  If Server what version of Jira is this?

Also what specific REST endpoint are you using when trying to POST here?   What payload is being sent via REST here?

I found a few related threads in community to this, such as https://community.atlassian.com/t5/Answers-Developer-Questions/Bamboo-REST-API-to-create-branches/qaq-p/477013 which suggests to look at https://serverfault.com/questions/164220/is-there-a-way-to-avoid-nginx-411-content-length-required-errors

Which indicates this could be a proxy problem, that you can work around with the header of

curl -i -X PUT -H 'Content-Length: 0' 'http://www.example.com/test'

Perhaps this can help. 

Please let me know.


Suggest an answer

Log in or Sign up to answer