Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I am Getting 400 Bad Request when creating Epic Issue in Jira

Hamed Deshmukh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 19, 2022

string JsonString = @"{
""fields"": {
""project"":
{
""key"": ""ABC""
},
""summary"": ""Summary"",

""description"":
{
""type"":""doc"",
""version"":1,
""content"":[
{
""type"":""paragraph"",
""content"":[
{
""type"":""text"",
""text"":""Description""
}
]
}
]
},
""customfield_10011"": ""XYZ"",
""issuetype"":
{
""name"": ""Epic""
}
}

string restUrl = String.Format("{0}rest/api/2/issue/", Url);
HttpWebResponse response = null;
HttpWebRequest request = WebRequest.Create(restUrl) as HttpWebRequest;
request.Method = "POST";
request.Accept = "application/json";
request.ContentType = "application/json";
request.Headers.Add("Authorization", "Basic " + EpicModel.GetEncodedCredentials(UserName, Password));
byte[] data = Encoding.UTF8.GetBytes(JsonString);
using (var requestStream = request.GetRequestStream())
{
requestStream.Write(data, 0, data.Length);
requestStream.Close();
}
using (response = request.GetResponse() as HttpWebResponse)
{
if (response.StatusCode == HttpStatusCode.Created)
{
var reader = new StreamReader(response.GetResponseStream());
string str = reader.ReadToEnd();

//var jss = new System.Web.Script.Serialization.JavaScriptSerializer();
//var sData = jss.Deserialize<Dictionary<string, string>>(str);
//string issueKey = sData["key"].ToString();

}

}
request.Abort();

1 answer

0 votes
Alessandro Lombardo
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 20, 2022

I think that you miss the field "Epic Name" that maybe is mandatory to fill with a value

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events