RestSharp を使用して POST リクエストを作成し、JIRA で問題を作成しようとしています。作業する必要があるのは、cURL を使用する例です。私は自分が間違っていることを知るのに十分なほど、どちらにも精通していません。
cURLでの例を次に示します。
curl -D- -u fred:fred -X POST --data {see below} -H "Content-Type: application/json"
http://localhost:8090/rest/api/2/issue/
サンプルデータは次のとおりです。
{"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"}}}
そして、これが私が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);
私が返すのは、の415応答です
Unsupported Media Type
注:この投稿で提案されていることも試しましたが、問題は解決しませんでした。任意のガイダンスをいただければ幸いです。