Create issue returns: {"errorMessages":[],"errors":{"project":"project is required"}}

Hi 

Here is my code:

string data = @"{ ""fields"": {
""project"":
{
""key"": ""HELP""
},
""summary"": ""Test Ticket"",
""description"": ""Creating of an issue using project keys and issue type names using the REST API"",
""issuetype"": {
""name"": ""Ticket""
},
""assignee"": { ""name"": ""user"" }
}
}";

try
{
var client = new RestClient();
client.BaseUrl = new Uri(Jira_systemID);
client.Authenticator = new HttpBasicAuthenticator(Jira_username, Jira_password);
var request = new RestRequest(Method.POST);
request.Resource = "rest/api/2/issue/";
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json", data, ParameterType.RequestBody);
request.RequestFormat = DataFormat.Json;
Service1.trace(fn + "before client.Execute");
IRestResponse response = client.Execute(request);
HttpStatusCode statusCode = response.StatusCode;

}

 

Any ideas why i get : {"errorMessages":[],"errors":{"project":"project is required"}}

 

Many thanks

Ilan

1 answer

0 votes
Alexey Matveev Community Champion Jan 21, 2018

Hello,

I just tried your json and it is valid. You have to find out what is really sent to Jira. I usually do it with Fiddler. You can proxy all requests over Fiddler and then you will be able to analize what is sent.

Or debug your program and see what is really sent to Jira.

Many thanks 

i works ok now with assignee=admin

but when i try with another user: ilan, i get an error

"errors":{"assignee":"User 'ilan' cannot be assigned issues."}}

 

i added "ilan" to "users" in my JIRA cloud account. 

Any ideas ?

thanks

Ilan

Alexey Matveev Community Champion Jan 22, 2018

There are can be several reasons:

1. ilan must be the user name not the display name. 

"assignee": {"name": "ilan" }

2. The user ilan can not be assigned to the issue. You can try to assign the user in Jira. If the user will be assigned then the user can be assigned

3. The user, by which your REST call authenticated in Jira, does not have permission to assign users in the project. Login to Jira by the same user and assign ilan to an issue upon creating.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,870 views 12 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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot