0
linkの「ステップ3:ユーザー2に代わって署名要求を送信する」セクションで概説したように、Docusign REST APIを呼び出そうとしています。以下のエラーが表示されます。境界には何が設定されていますか?どのように正しく設定するのですか?Docusign REST APIコール - 「境界ターミネーターが見つかりませんでした」
{ "のerrorCode": "INVALID_MULTI_PART_REQUEST"、 "メッセージ":「マルチパート要求の解析中にエラーが検出された境界ターミネーター '--BOUNDARY;のcharset = UTF-8--が' で見つかりませんでした要求。" }
public static string HttpRequest(string url, List<CELPHttpHeader> headerList, EnvelopeDefinition envelopeDefination)
{
string responseString = string.Empty;
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("accept", "application/json");
MediaTypeHeaderValue mediaType = new MediaTypeHeaderValue("multipart/form-data");
NameValueHeaderValue item = new NameValueHeaderValue("boundary", "BOUNDARY");
mediaType.Parameters.Add(item);
JsonMediaTypeFormatter formatter = new JsonMediaTypeFormatter();
HttpRequestMessage requestMessage = new HttpRequestMessage();
requestMessage.Method = HttpMethod.Post;
requestMessage.Content = new ObjectContent<EnvelopeDefinition>(envelopeDefination, formatter, mediaType);
foreach (CELPHttpHeader header in headerList)
{
client.DefaultRequestHeaders.Add(header.Name, header.Value);
}
try
{
Task<HttpResponseMessage> webTaskResult = client.PostAsync(url, requestMessage.Content);
webTaskResult.Wait();
HttpResponseMessage response = webTaskResult.Result;
}
catch (Exception ex)
{
}
return (responseString);
}
参照ルイス答えは - 私はあなたの要求で境界が誤エンコードを得ていると思います。 "; charset = utf-8"は別のパラメータから来ているようです。境界は、セミコロンではなく、行区切り記号を使用してパーツのヘッダーから区切る必要があります。 –
ありがとうございましたJeff、私は問題がEnvelopeDefinationが間違ったフォーマットであり、マルチパートリクエストのフォーマットが間違っていたと考えました。 –