lazy rabbit
lazy rabbit

Reputation: 1086

Creating JIRA issue using curl from command line

I've been through documentation here according to which I'm creating a issue for JIRA . I know I'm making some terribly small mistake . I'm trying to create a new JIRA request from command line (later I'll integrate in my java code) From my Mac terminal I'm trying to run :

    curl -D- -u username:password -X POST --data {"fields":{"project":{"key": “PROJECTKEY"},"summary": "REST ye merry gentlemen.","description": "Creating of an issue using project keys and issue type names using the REST API","issuetype": {"name": "Bug"}}} -H "Content-Type: application/json" https://mycompanyname.atlassian.net/rest/api/2/issue/

I believe this has something to do with the "data". Thanks in advance. The example has been taken from the documentation link itself.

OUTPUT : I'm getting nothing in my terminal, no error, no expected output .

PROJECTKEY is taken from the KEY column from the All Project list in my DASHBOARD.

Upvotes: 12

Views: 14899

Answers (1)

Hans Z.
Hans Z.

Reputation: 54118

Two things are off:

  1. you need to put the data that you want to post in quotes
  2. the first double quote surrounding PROJECT_KEY is a unicode character instead of a regular double quote, so change “PROJECTKEY" to "PROJECTKEY"

This should work:

curl -D- -u username:password -X POST --data '{"fields":{"project":{"key": "PROJECTKEY"},"summary": "REST ye merry gentlemen.","description": "Creating of an issue using project keys and issue type names using the REST API","issuetype": {"name": "Bug"}}}' -H "Content-Type: application/json" https://mycompanyname.atlassian.net/rest/api/2/issue/

Upvotes: 13

Related Questions