how to create an issue in jira via rest api?

ymajoros picture ymajoros · May 4, 2011 · Viewed 57.9k times · Source

Is it possible to create an issue in jira using REST api? I didn't find this in the documentation (no POST for issues), but I suspect it's possible.

A wget or curl example would be nice.

Answer

msangel picture msangel · May 3, 2012

POST to this URL

https://<JIRA_HOST>/rest/api/2/issue/

This data:

{
"fields": {
   "project":
   { 
      "key": "<PROJECT_KEY>"
   },
   "summary": "REST EXAMPLE",
   "description": "Creating an issue via REST API",
   "issuetype": {
      "name": "Bug"
   }
  }
}

In received answer will be ID and key of your ISSUE:

{"id":"83336","key":"PROJECT_KEY-4","self":"https://<JIRA_HOST>/rest/api/2/issue/83336"}

Don't forget about authorization. I used HTTP-Basic one.