Используя RestSharp 112.1.0 и Request.AddJsonBody, как изменить имя со стандартного «application/json» на конкретное имя ?
Я постоянно получаю name="application/json"
Мой код ->
Код: Выделить всё
var myAddDocumentClient = new RestClient(options);
myAddDocumentClient.AddDefaultHeader("Authorization", accessTokenBearer);
RestRequest myAddDocumentRequest = new RestRequest(myAddDocuments, Method.Post);
myAddDocumentRequest.RequestFormat = DataFormat.Json;
myAddDocumentRequest.AlwaysMultipartFormData = true;`
myAddDocumentRequest.AddJsonBody(myPackageDocuments, ContentType.Json);
Код: Выделить всё
--ddfaa976-b6fc-4521-bbe0-dd73e5f83517
Content-Type: application/json; charset=utf-8
Content-Disposition: form-data; name="application/json"
{"executionType":"E-Sign","name":"test1","order":1,"participants":[{"participantUid":"abcdefg","state":"REQUIRED"}]}
--ddfaa976-b6fc-4521-bbe0-dd73e5f83517--
Код: Выделить всё
62
{"title":"Bad Request","status":400,"detail":"Required part 'documentProperties' is not present."}
0
мои классы приведены ниже, и я попробовал их с помощью и без этого закомментировал Имя ниже.
Код: Выделить всё
public class documentProperties
{
// [RequestProperty(Name = "documentProperties")]
public string executionType { get; set; }
public string name { get; set; }
public int order { get; set; }
public List
participants { get; set; }
}
public class Participant
{
public string participantUid { get; set; }
public string state { get; set; }
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... ify-a-name
Мобильная версия