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"}]}}
"project": { "key":"DevOps_Touch & Feel (DF)" }
That is definitely not the Project Key, looks more like the Name.
Well.. the Project Key, obviously.
ASDDDD or REWR or RQW in the following example
projectkey.PNG
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The thing that fixed it for me was by adding the follwoing to the JSON. I needed both the key and id of the project. Once you do this it may ask you for some other "required" fields. The easiest way to find the values/id's/keys of these are to curl Get a specific issue and look through the returned json. https://stackoverflow.com/questions/50099499/using-jira-rest-api-how-can-i-get-description-of-a-specific-issue
"project":
{
"id": <YOUR PROJECT ID IN QUOTES>,
"key": <YOUR PROJECT KEY IN QUOTES"
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.