Я работаю на веб-сайте ASP.NET (WebForms, v4.5). Я предоставляю интегрированное решение Docu-Sign с этим сайтом. Я попробовал API REST API для запуска e-Sign, загрузка подписанного документа..etc (который отлично работает для меня). Теперь я работаю над получением статуса нескольких идентификаторов конвертов. Здесь конечная точка находится {vx}/accounts/{accountid}/envelopes/status
Получение информации о статусе нескольких идентификаторов конверта в Docusign
Теперь запрос PUT, который я делаю возникает следующее сообщение об ошибке:
The remote server returned an error: (400) Bad Request.
фрагмент кода выглядит следующим образом:
string username = "YOUR_USERNAME";
string password = "YOUR_PASSWORD";
string integratorKey = "YOUR_INTEGRATOR_KEY";
string url = "https://demo.docusign.net/restapi/v2/login_information";
string baseURL = "";
string accountId = "";
string authenticateStr =
"<DocuSignCredentials>" +
"<Username>" + username + "</Username>" +
"<Password>" + password + "</Password>" +
"<IntegratorKey>" + integratorKey + "</IntegratorKey>" +
"</DocuSignCredentials>";
//
// STEP 1 - Login
//
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Headers.Add("X-DocuSign-Authentication", authenticateStr);
request.Accept = "application/xml";
request.Method = "GET";
HttpWebResponse webResponse = (HttpWebResponse)request.GetResponse();
StreamReader sr = new StreamReader(webResponse.GetResponseStream());
string responseText = sr.ReadToEnd();
using (XmlReader reader = XmlReader.Create(new StringReader(responseText)))
{
while (reader.Read())
{ // Parse the xml response body
if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "accountId"))
accountId = reader.ReadString();
if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "baseUrl"))
baseURL = reader.ReadString();
}
}
//
// STEP 2 - Get Envelope Status(es)
//
string envlpIds = "<envelopeIds><string>2e552785-3e1c-458b-9513-9778f59b37ae</string><string>0c0844fc-148f-4c2f-a16a-765a73a8efe0</string></envelopeIds>";
request = (HttpWebRequest)WebRequest.Create(baseURL + "/envelopes/status");
request.Headers.Add("X-DocuSign-Authentication", authenticateStr);
request.Accept = "application/xml";
request.Method = "PUT";
request.ContentType = "application/xml";
request.ContentLength = envlpIds.Length;
byte[] body = System.Text.Encoding.UTF8.GetBytes(envlpIds);
Stream dataStream = request.GetRequestStream();
dataStream.Write(body, 0, envlpIds.Length);
dataStream.Close();
// read the response
webResponse = (HttpWebResponse)request.GetResponse();
sr.Close();
responseText = "";
sr = new StreamReader(webResponse.GetResponseStream());
responseText = sr.ReadToEnd();
//--- display results
lblmsg.Text = responseText;
}
catch (Exception ex)
{
lblmsg.Text = ex.Message;
}
Что я здесь отсутствует ? Пожалуйста, помогите мне в исправлении этого?
UPDATE:
Пробовал оберточной конверт ID следующим образом:
<envelopeIds>
<envelopeId>2e552785-3e1c-458b-9513-9778f59b37ae</envelopeId>
<envelopeId>0c0844fc-148f-4c2f-a16a-765a73a8efe0</envelopeId>
</envelopeIds>
все еще получаю ту же ошибку.
Также попробовал дополнительный параметр querysting следующим образом:
PUT /restapi/v2/accounts/######/envelopes/status?envelope_ids=request_body
который также не работает.
Я думаю, то же самое, что Ким упоминалось, попробуйте изменить имена тегов XML от '' в '' –
Ergin
@Ergin: Пробовал то же самое, но не повезло – Bisileesh