RestSharp의 게시물 요청에 문제가 있습니다. 나는이 개 수업이 있습니다RestSharp - 게시 요청 문제 (작업 실패)
public class UnitToPost
{
public bool floating_point { get; set; }
public Dictionary<string, TranslationUnitToPost> translations { get; set; }
}
public class TranslationUnitToPost
{
public string name { get; set; }
}
을 그리고 난 후 요청을 보낼 :
client = new RestClient(adresApi);
client.AddDefaultHeader("Authorization", "Bearer " + key);
IRestRequest updateProduct = new RestRequest("units", Method.POST);
ShoperModel.UnitToPost unitToPost = new ShoperModel.UnitToPost();
unitToPost.floating_point = true;
ShoperModel.TranslationUnitToPost transUnit = new ShoperModel.TranslationUnitToPost();
transUnit.name = "namename";
unitToPost.translations = new Dictionary<string, ShoperModel.TranslationUnitToPost>();
unitToPost.translations.Add("pl_PL", transUnit);
updateProduct.RequestFormat = RestSharp.DataFormat.Json;
updateProduct.AddBody(unitToPost);
IRestResponse updateProductResponse = this.client.Execute(updateProduct);
그리고 난 항상 오류 얻을 :
[RestSharp.RestResponse] = "StatusCode: InternalServerError, Content-Type: application/json, Content-Length: -1)"
Content = "{\"error\":\"server_error\",\"error_description\":\"Operation Failed\"}"
그것의 원인은 무엇입니까? 그것은 내 수업에서 사전 때문일 수 있습니까?