Jira HTTP bad request "Project is required"

Hi I am getting an error 

HTTP Bad request 400

(  "Errormessages " : [], "errors":("project": "Project is required"))

 

my curl command=

curl -D- --user POST --data @C:\Adwait\AdwaitWorkspace\WS2\Login\jira\createJiraIssue.json -H "Authorization: Basic Yuuuuuu" -H "Content-Type: application/json" "http://xxxxx/rest/api/2/issue" -k -o C:\Adwait\AdwaitWorkspace\WS2\Login\jira\createJiraIssue-Output.json

 

my json=

{
"fields":
{
"project":
{
"key":"DevOps_Touch & Feel (DF)"
},"summary":"Performance test","description":"","environment":"","assignee":{"name":"A","emailAddress":"emailid_assignee"},"issuetype":{"name":"Bug"},"labels":["Automation"],"customfield_10222":[{"value":"Test1"}]}}

2 answers

"project": {
    "key":"DevOps_Touch & Feel (DF)"
}

That is definitely not the Project Key, looks more like the Name.

yes that is the name. What do i need to give as key?

Well.. the Project Key, obviously.

ASDDDD or REWR or RQW in the following example

projectkey.PNG

Were you able to resolve it, Even after adding key , I am getting issue

JSONObject fields = new JSONObject();
JSONObject project = new JSONObject();
project.put("key", "1");
project.put("id", "intqm");
project.put("name","sample");
fields.put("project",project);
//fields.put("project", "1");
// fields.put("issuetype", new JSONObject().put("id", issuetypeid.toString()));
// fields.put("summary", "Test from JiraRestClient");
//fields.put("description", "Lorem ipsum...");

JSONObject issue = new JSONObject();
issue.put("fields", fields);

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

243 views 1 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