12

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.

3
  • you need to put your posted data in single quotes Commented Jun 25, 2015 at 14:09
  • Can you give me a example? Thanks in advance.. Commented Jun 25, 2015 at 14:11
  • --data '{"fields": ....... }' Commented Jun 25, 2015 at 14:12

1 Answer 1

13

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/
Sign up to request clarification or add additional context in comments.

5 Comments

Z That was probably a mistake thanks.. But now I'm getting a error : {"errorMessages":["Version Found: Version Found is required."],"errors":{}} any help on this plss ??
This works for me. JIRA is created but i do not get the JIRA number (ID) in the logs. Please let me know if i'm missing anything.
Essentially, i want to store the JIRA number in a variable which can be used in the scripts for other purposes.
Above syntax was working fine for me but suddenly I've started getting this error message: curl: (3) [globbing] unmatched close brace/bracket in column 202. What am i mssing?
@Yash Try using curl's -g or --globoff option. Check the man page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.