How to Create Issue Using Rest API - POST /rest/api/2/issue

Hello I'm using an ASP.NET C# WCF service application to interact with JIRA via the REST API.

I have had luck with nearly all of the GET requests, but none of the POST requests.

The instance of JIRA that I'm interacting with is cloud-hosted, JIRA v7.1.0-OD-02-030.

My post data for creating an issue:

{
"update": null,
"fields": {
"project": {
"id": "10300"
},
"summary": "Test jira issue 01",
"issuetype": {
"id": "10000"
},
"assignee": null,
"reporter": null,
"priority": {
"id": "3"
},
"labels": [],
"timetracking": null,
"description": "This is a test description value.",
"duedate": "2015-12-30",
"fixVersions": [],
"components": [],
"customfield_10009": null
}
}

This results in an HTTP 400 response, with a body of:

{
"errorMessages": [
"Internal server error"
],
"errors": {}
}

The message is vague, but if I would have to guess I'm thinking the REST API is encountering an HTTP 500 on its end, and is sending the HTTP 500 "Internal server error" exception message back to me.

 

As you can see from my post data, I'm sending the bare minimum in terms of field/value pairs in hopes of getting just a single issue to be created via this REST API.

 

The issue type id, priority id, project id, and customfield_10009 values I pulled from REST API response for "Get Issue" :

GET /rest/api/2/issue/

for one of the other issues on the JIRA project I'm targeting for the issue creation. (this way I know their values are valid for this project: 10300)

Any help is appreciated, thanks,

-Eric

2 answers

This widget could not be displayed.

When I run into problems with JIRA's REST api, the first two things I check are: 1) Does the account I'm using have the correct permissions? Is it allowed to create issues in the project? 2) Are all fields on a screen so that they can be edited? It seems like I solve 90% of my errors with unhelpful error messages this way... I'd also try to simplify things a bit... if the value is null/empty, why set it? Jason

This widget could not be displayed.

Thanks for the tips Jason! I was able to get an Issue created via the REST API by removing my null/empty array values. I'll keep this in mind going forward, I was taking the documentation examples too literally.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

215 views 3 0
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