【发布时间】:2018-10-23 08:22:06
【问题描述】:
我正在以 xml 格式进行 API 调用。使用 url 作为http://www.docusign.net/restapi/v2/login_information 和生产凭据详细信息,我正在检索 accountID 和 Baseurl 然后我尝试以 xml 格式请求信封结果,如下所示
字符串 requestBody = "http://www.docusign.com/restapi\">" +
"<accountId>" + accountId + "</accountId>" +
"<status>sent</status>" +
"<emailSubject>API Call for Embedded Sending</emailSubject>" +
"<emailBlurb>This comes from C#</emailBlurb>" +
"<templateId>" + templateId + "</templateId>" +
"<templateRoles>" +
"<templateRole>" +
"<email>" + username + "</email>" + // NOTE: Use different email address if username provided in non-email format!
"<name>Name</name>" + // username can be in email format or an actual ID string
"<roleName>" + roleName + "</roleName>" +
"</templateRole>" +
"</templateRoles>" +
"</envelopeDefinition>";
然后我正在拨打电话
request = (HttpWebRequest)WebRequest.Create(baseURL + "/envelopes");
request.Headers.Add("X-DocuSign-Authentication", authenticateStr);
request.ContentType = "application/xml";
request.Accept = "application/xml";
request.ContentLength = requestBody.Length;
request.Method = "POST";
// write the body of the request
byte[] body = System.Text.Encoding.UTF8.GetBytes(requestBody);
Stream dataStream = request.GetRequestStream();
dataStream.Write(body, 0, requestBody.Length);
dataStream.Close();
// read the response
webResponse = (HttpWebResponse)request.GetResponse();
在最后一行,它给出了 400 bad request 的错误。
这适用于模拟帐户,但在生产帐户中会出现 400 错误。感谢所有试图帮助我的人。
【问题讨论】:
标签: api docusignapi