I'm trying to make a POST request using RestSharp to create an issue in JIRA, and what I have to work with is an example that uses cURL. I'm not familiar with either enough to know what I'm doing wrong.
Here's the example given in cURL:
curl -D- -u fred:fred -X POST --data {see below} -H "Content-Type: application/json"
http://localhost:8090/rest/api/2/issue/
Here's their example data:
{"fields":{"project":{"key":"TEST"},"summary":"REST ye merry gentlemen.","description":"Creating of an issue using project keys and issue type names using the REST API","issuetype":{"name":"Bug"}}}
And here's what I'm attempting with RestSharp:
RestClient client = new RestClient();
client.BaseUrl = "https://....";
client.Authenticator = new HttpBasicAuthenticator(username, password);
....// connection is good, I use it to get issues from JIRA
RestRequest request = new RestRequest("issue", Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("data", request.JsonSerializer.Serialize(issueToCreate));
request.RequestFormat = DataFormat.Json;
IRestResponse response = client.Execute(request);
What I get back is a 415 response of
Unsupported Media Type
Note: I also tried what was suggested in this post, but that did not resolve the issue. Any guidance is appreciated!