您将非常感谢您了解当前.setRequestHeader设置应该针对此错误。
Public Sub SignatureReq()
Dim httpRequest As MSXML2.XMLHTTP60
' defined request and result variables
Set httpRequest = New XMLHTTP60
' define the new URL for the signature request using the Base URL returned aboved appended with '/envelopes'
Dim sigURL As String
sigURL = URLBase & "/envelopes"
' currently sig URL is 'https://demo.docusign.net/restapi/v2/accounts/[account number]'
Dim Body As String
Body = "<envelopeDefinition xmlns=\" & Chr(34) & "http://www.docusign.com/restapi\" & Chr(34) & ">" + _
"<accountId>MyAccountID</accountId>" + _
"<status>sent</status>" + _
"<emailSubject>DocuSign API Call - Signature request from template</emailSubject>" + _
"<templateId>MyTemplateID</templateId>" + _
"<templateRoles>" + _
"<templateRole>" + _
"<name>Ronco</name>" + _
"<email>rolsen@myemail.com</email>" + _
"<roleName>Rono</roleName>" + _
"</templateRole>" + _
"</templateRoles>" + _
"</envelopeDefinition>"
Debug.Print Body
httpRequest.Open "POST", sigURL, False
httpRequest.setRequestHeader Body, "application/xml"
httpRequest.setRequestHeader "X-DocuSign-Authentication", Author
'httpRequest.setRequestHeader "Accept", "application/xml"
httpRequest.setRequestHeader "Content-Type", "multipart/form-data"
'httpRequest.setRequestHeader "Content-Type", "application/xml"
httpRequest.send
Debug.Print httpRequest.Status, "A"
Debug.Print httpRequest.statusText, "B"
Debug.Print httpRequest.responseText, "C"
Exit Sub
回复信息如下。我理解错误来自.setRequestHeader
没有正确设置。在哪里可以找到为.setRequestHeader
将接受的每个DocuSign
设置标头和值的方式?
400 Bad Request {“errorCode”: “ENVELOPE_IS_INCOMPLETE”,“message”:“信封不完整。 完整信封需要文档,收件人,选项卡和a 主题行。 Content-Type不包含边界参数。“}
答案 0 :(得分:0)
从模板发送签名请求时,API调用的Content-Type
需要设置为application/json
或application/xml
。看起来你现在已经注释掉并发送了multipart/form-data
个请求。排除并添加回来的注释:
httpRequest.setRequestHeader "Content-Type", "application/xml"
如果这不起作用,或者您已经尝试过,我建议您通过开发者帐户首选项启用请求记录,并检查正在设置的原始请求确保您的代码生成您期望的内容。