Hi guys,
I have an issue i think it is not with the json.
When i used the same json in the postman application, everything worked fine.
im trying to post through my winform programs in C#. Below is my code.:
public void createIssue()
{
string data = "{'fields': {'project':{'key': 'RSSPSI'},'summary': 'Test','description': 'TESTING','issuetype': {'name': 'Staging Installations'},'customfield_10807': '2018 - 09 - 19T10: 00:00.000 + 0000','customfield_15924': [{'value':'TEST 10'}],'customfield_11201': {'value':'RS2SP'},'customfield_16000': 'API TEST','components': [{'name':'System Engineer'}]}}";
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("https://LINKTOJIRA/rest/api/2/");
byte[] cred = UTF8Encoding.UTF8.GetBytes("username":" + "password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(cred));
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
var content = new StringContent(data, Encoding.UTF8, "application/json");
System.Net.Http.HttpResponseMessage response = client.PostAsync("issue", content).Result;
Console.WriteLine("Create Issue Response : \n" + response);
}
}
What I have tried:
I tried to check if the json is wrong or not but in postman app, everythign worked fine so maybe im doind something wrong with the request ?