Using rest API how do i create a ticket in JIRA? What are the steps?


Trying to use CURL to post the tickets into JIRA system.


I used GET which works fine but the POST seems to have issue


curl -D- -u -X GET -H "Content-Type: application/json" http://localhost:8080/rest/api/2/search?jql=assignee=Sandhya


curl -D- -u -X POST -H "Content-Type: application/json" --data { "fields": {"project":{ "key": "TEST" },"summary": "REST ye merry gentlemen.","description": " REST API","issuetype": {"name": "Bug" } }}




3 answers

Hi Sandhya!

First, you'll have to make sure the Project mentioned in the curl command exists on the instance as well as the Issue Type. In a template Service Desk project at my local staging instance, the following command worked just fine:

curl -D- -u user:password -X POST -H "Content-Type: application/json" --data '{ "fields": {"project":{ "key": "JS" },"summary": "REST ye merry gentlemen.","description": " REST API","issuetype": {"name": "IT Help" } }}' http://localhost:8080/rest/api/2/issue/

information Note that I surrounded the --data arguments with simple quotes as well.

If you are still unable to proceed, please specify the error message thrown out by JIRA.




Thank you! 

The below command works fine.  

curl -D- -u -X POST --data @/data.txt -H "Content-Type: application/json" http://a.b.c.d:8080/rest/api/2/issue/ 


"project": {"key": "test"},
"summary": "REST",
"description": "REST 2",
"issuetype": { "id": "3" }

While trying to have JIRA as an output to logstash using logstash-output-jira plugin that uses jiralicious 0.2.2, I get the below error after starting logstash to create ticket. What is the best jiralicious version that could be used which has resolution for this kind of issue.

Please redirect me to right forum if needed. 

Errno::ECONNREFUSED: Connection refused - Connection refused


initialize at org/jruby/ext/socket/
open at org/jruby/
connect at /opt/logstash/vendor/jruby/lib/ruby/1.9/net/http.rb:763
timeout at org/jruby/ext/timeout/
connect at /opt/logstash/vendor/jruby/lib/ruby/1.9/net/http.rb:763
do_start at /opt/logstash/vendor/jruby/lib/ruby/1.9/net/http.rb:756
start at /opt/logstash/vendor/jruby/lib/ruby/1.9/net/http.rb:745
request at /opt/logstash/vendor/jruby/lib/ruby/1.9/net/http.rb:1293
perform at /opt/logstash/vendor/bundle/jruby/1.9/gems/httparty-0.11.0/lib/httparty/request.rb:92
perform_request at /opt/logstash/vendor/bundle/jruby/1.9/gems/httparty-0.11.0/lib/httparty.rb:461
post at /opt/logstash/vendor/bundle/jruby/1.9/gems/httparty-0.11.0/lib/httparty.rb:414
request at /opt/logstash/vendor/bundle/jruby/1.9/gems/jiralicious-0.2.2/lib/jiralicious/session.rb:29
login at /opt/logstash/vendor/bundle/jruby/1.9/gems/jiralicious-0.2.2/lib/jiralicious/cookie_session.rb:60
before_request at /opt/logstash/vendor/bundle/jruby/1.9/gems/jiralicious-0.2.2/lib/jiralicious/cookie_session.rb:20
request at /opt/logstash/vendor/bundle/jruby/1.9/gems/jiralicious-0.2.2/lib/jiralicious/session.rb:28
fetch at /opt/logstash/vendor/bundle/jruby/1.9/gems/jiralicious-0.2.2/lib/jiralicious/base.rb:92
create at /opt/logstash/vendor/bundle/jruby/1.9/gems/jiralicious-0.2.2/lib/jiralicious/issue.rb:96
save at /opt/logstash/vendor/bundle/jruby/1.9/gems/jiralicious-0.2.2/lib/jiralicious/issue.rb:196
receive at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-jira-0.1.4/lib/logstash/outputs/jira.rb:99
handle at /opt/logstash/lib/logstash/outputs/base.rb:88
initialize at (eval):27
call at org/jruby/
output at /opt/logstash/lib/logstash/pipeline.rb:279
outputworker at /opt/logstash/lib/logstash/pipeline.rb:235
start_outputs at /opt/logstash/lib/logstash/pipeline.rb:163


Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,096 views 13 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot