C# docusignrestapi,can';是否不添加多个文档?
我正在为DocuSign API使用以下包装器: 只要我只使用一个文档,一切都很好。但是,如果我传入多个文档,它只使用第一个文档,就像在电子邮件中单击链接一样,唯一可见的文档就是第一个文档:C# docusignrestapi,can';是否不添加多个文档?,c#,vb.net,docusignapi,C#,Vb.net,Docusignapi,我正在为DocuSign API使用以下包装器: 只要我只使用一个文档,一切都很好。但是,如果我传入多个文档,它只使用第一个文档,就像在电子邮件中单击链接一样,唯一可见的文档就是第一个文档: Dim信封作为新信封定义(), api作为新的信封api() 带信封 .TemplateId=_model.TemplateId .EmailSubject=\u model.EmailSubject .Status=“已发送” 以 如果_model.Documents不是空的,并且_model.Docum
Dim信封作为新信封定义(),
api作为新的信封api()
带信封
.TemplateId=_model.TemplateId
.EmailSubject=\u model.EmailSubject
.Status=“已发送”
以
如果_model.Documents不是空的,并且_model.Documents.Count>0,则
Dim文件作为新列表(文件)()
对于_model.Documents中的每个文档
Dim tDoc作为新文档()
与时差
.Name=文件名
.FileExtension=doc.Extension.Replace(“.”,“”)
.DocumentId=doc.ID
.DocumentBase64=System.Convert.ToBase64字符串(doc.FileBytes)
以
文件添加(tDoc)
下一个
信封文件=文件
如果结束
如果_model.Recipients不是空,并且_model.Recipients.Count>0,则
将TemplateRole调整为新列表(TemplateRole)()
对于_model.Recipients中的每个收件人
Dim角色作为新的TemplateRole()
扮演角色
.Email=收件人.Email
.Name=收件人.Name
.RoleName=recipient.RoleName
.Tabs=新选项卡()
.Tabs.SignHereTabs=新列表(此处的签名)
对于信封中的每个文档。文档
Dim signHere作为新的signHere()
签名在这里
.DocumentId=doc.DocumentId
.AnchorString=recipient.AnchorText
.AnchorIgnoreIfNotPresent=“true”
以
.Tabs.SignHereTabs.Add(在此处签名)
下一个
以
templateRoles.Add(角色)
下一个收件人
envelope.TemplateRoles=TemplateRoles
如果结束
Dim摘要为EnvelopesSummary=api.CreateEnvelope(_model.Authentication.AccountID,envelope)
欢迎使用C#示例,或VB.NET,或只是有关问题的一般帮助
--更新--
下面是json格式的请求:
POST https:
//demo.docusign.net:7801/restapi/v2/accounts/MYACCOUNTNUMBER/envelopes
Content - Length: 415238
Content - Type: application / json
Accept: application / json
Host: demo.docusign.net
User - Agent: RestSharp / 105.1.0.0
X - DocuSign - SDK: C #
X - DocuSign - Authentication: {
"Username": "myusername@somewhere.com",
"Password": "[omitted]",
"IntegratorKey": "[omitted]"
}
X - Forwarded - For: 55.55.555.555
X - SecurityProtocol - Version: TLSv1
X - SecurityProtocol - CipherSuite: ECDHE - RSA - AES256 - CBC - SHA {
"documents": [{
"documentId": "1",
"uri": null,
"remoteUrl": null,
"name": "Test1",
"password": null,
"transformPdfFields": null,
"fileExtension": "pdf",
"matchBoxes": null,
"order": null,
"pages": null,
"documentFields": null,
"encryptedWithKeyManager": null,
"documentBase64": "JVBERi0xLjUNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL= ETC ETC",
"applyAnchorTabs": null
}, {
"documentId": "2",
"uri": null,
"remoteUrl": null,
"name": "Test2",
"password": null,
"transformPdfFields": null,
"fileExtension": "pdf",
"matchBoxes": null,
"order": null,
"pages": null,
"documentFields": null,
"encryptedWithKeyManager": null,
"documentBase64": "JVBERi0xLjUNCiW1tbW1DQoxIDAgb2JqDQo8PC9U== ETC ETC",
"applyAnchorTabs": null
}, {
"documentId": "3",
"uri": null,
"remoteUrl": null,
"name": "Test3",
"password": null,
"transformPdfFields": null,
"fileExtension": "pdf",
"matchBoxes": null,
"order": null,
"pages": null,
"documentFields": null,
"encryptedWithKeyManager": null,
"documentBase64": "JVBERi0xLjUNCiW1tbW1DQoxIDAgb2JqDQo8PC9Ue ETC ETC",
"applyAnchorTabs": null
}],
"recipients": null,
"customFields": null,
"eventNotification": null,
"brandId": null,
"allowRecipientRecursion": null,
"templateId": "MYTEMPLATEID",
"templateRoles": [{
"email": "MYEMAIL@me.com",
"roleName": "Customer",
"name": "John Doe",
"signingGroupId": null,
"inPersonSignerName": null,
"clientUserId": null,
"embeddedRecipientStartURL": null,
"defaultRecipient": null,
"accessCode": null,
"routingOrder": null,
"emailNotification": null,
"tabs": {
"signHereTabs": [{
"name": null,
"tabLabel": null,
"scaleValue": null,
"optional": null,
"documentId": "1",
"recipientId": null,
"pageNumber": null,
"xPosition": null,
"yPosition": null,
"anchorString": "customeranchor",
"anchorXOffset": null,
"anchorYOffset": null,
"anchorUnits": null,
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": null,
"anchorMatchWholeWord": null,
"anchorHorizontalAlignment": null,
"tabId": null,
"templateLocked": null,
"templateRequired": null,
"conditionalParentLabel": null,
"conditionalParentValue": null,
"customTabId": null,
"mergeField": null,
"status": null,
"errorDetails": null
}, {
"name": null,
"tabLabel": null,
"scaleValue": null,
"optional": null,
"documentId": "2",
"recipientId": null,
"pageNumber": null,
"xPosition": null,
"yPosition": null,
"anchorString": "customeranchor",
"anchorXOffset": null,
"anchorYOffset": null,
"anchorUnits": null,
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": null,
"anchorMatchWholeWord": null,
"anchorHorizontalAlignment": null,
"tabId": null,
"templateLocked": null,
"templateRequired": null,
"conditionalParentLabel": null,
"conditionalParentValue": null,
"customTabId": null,
"mergeField": null,
"status": null,
"errorDetails": null
}, {
"name": null,
"tabLabel": null,
"scaleValue": null,
"optional": null,
"documentId": "3",
"recipientId": null,
"pageNumber": null,
"xPosition": null,
"yPosition": null,
"anchorString": "customeranchor",
"anchorXOffset": null,
"anchorYOffset": null,
"anchorUnits": null,
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": null,
"anchorMatchWholeWord": null,
"anchorHorizontalAlignment": null,
"tabId": null,
"templateLocked": null,
"templateRequired": null,
"conditionalParentLabel": null,
"conditionalParentValue": null,
"customTabId": null,
"mergeField": null,
"status": null,
"errorDetails": null
}],
"initialHereTabs": null,
"signerAttachmentTabs": null,
"approveTabs": null,
"declineTabs": null,
"fullNameTabs": null,
"dateSignedTabs": null,
"envelopeIdTabs": null,
"companyTabs": null,
"titleTabs": null,
"textTabs": null,
"numberTabs": null,
"ssnTabs": null,
"dateTabs": null,
"zipTabs": null,
"emailTabs": null,
"noteTabs": null,
"checkboxTabs": null,
"radioGroupTabs": null,
"listTabs": null,
"firstNameTabs": null,
"lastNameTabs": null,
"emailAddressTabs": null,
"formulaTabs": null
}
}, {
"email": null,
"roleName": "Account Manager",
"name": null,
"signingGroupId": null,
"inPersonSignerName": null,
"clientUserId": null,
"embeddedRecipientStartURL": null,
"defaultRecipient": null,
"accessCode": null,
"routingOrder": null,
"emailNotification": null,
"tabs": {
"signHereTabs": [{
"name": null,
"tabLabel": null,
"scaleValue": null,
"optional": null,
"documentId": "1",
"recipientId": null,
"pageNumber": null,
"xPosition": null,
"yPosition": null,
"anchorString": "adminanchor",
"anchorXOffset": null,
"anchorYOffset": null,
"anchorUnits": null,
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": null,
"anchorMatchWholeWord": null,
"anchorHorizontalAlignment": null,
"tabId": null,
"templateLocked": null,
"templateRequired": null,
"conditionalParentLabel": null,
"conditionalParentValue": null,
"customTabId": null,
"mergeField": null,
"status": null,
"errorDetails": null
}, {
"name": null,
"tabLabel": null,
"scaleValue": null,
"optional": null,
"documentId": "2",
"recipientId": null,
"pageNumber": null,
"xPosition": null,
"yPosition": null,
"anchorString": "adminanchor",
"anchorXOffset": null,
"anchorYOffset": null,
"anchorUnits": null,
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": null,
"anchorMatchWholeWord": null,
"anchorHorizontalAlignment": null,
"tabId": null,
"templateLocked": null,
"templateRequired": null,
"conditionalParentLabel": null,
"conditionalParentValue": null,
"customTabId": null,
"mergeField": null,
"status": null,
"errorDetails": null
}, {
"name": null,
"tabLabel": null,
"scaleValue": null,
"optional": null,
"documentId": "3",
"recipientId": null,
"pageNumber": null,
"xPosition": null,
"yPosition": null,
"anchorString": "adminanchor",
"anchorXOffset": null,
"anchorYOffset": null,
"anchorUnits": null,
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": null,
"anchorMatchWholeWord": null,
"anchorHorizontalAlignment": null,
"tabId": null,
"templateLocked": null,
"templateRequired": null,
"conditionalParentLabel": null,
"conditionalParentValue": null,
"customTabId": null,
"mergeField": null,
"status": null,
"errorDetails": null
}],
"initialHereTabs": null,
"signerAttachmentTabs": null,
"approveTabs": null,
"declineTabs": null,
"fullNameTabs": null,
"dateSignedTabs": null,
"envelopeIdTabs": null,
"companyTabs": null,
"titleTabs": null,
"textTabs": null,
"numberTabs": null,
"ssnTabs": null,
"dateTabs": null,
"zipTabs": null,
"emailTabs": null,
"noteTabs": null,
"checkboxTabs": null,
"radioGroupTabs": null,
"listTabs": null,
"firstNameTabs": null,
"lastNameTabs": null,
"emailAddressTabs": null,
"formulaTabs": null
}
}],
"compositeTemplates": null,
"accessibility": null,
"transactionId": null,
"status": "sent",
"documentsUri": null,
"recipientsUri": null,
"asynchronous": null,
"envelopeUri": null,
"emailSubject": "Test DocuSign - Hello World",
"emailBlurb": null,
"envelopeId": null,
"signingLocation": null,
"customFieldsUri": null,
"envelopeIdStamping": null,
"authoritativeCopy": null,
"notification": null,
"notificationUri": null,
"enforceSignerVisibility": null,
"enableWetSign": null,
"allowMarkup": null,
"allowReassign": null,
"createdDateTime": null,
"lastModifiedDateTime": null,
"deliveredDateTime": null,
"sentDateTime": null,
"completedDateTime": null,
"voidedDateTime": null,
"voidedReason": null,
"deletedDateTime": null,
"declinedDateTime": null,
"statusChangedDateTime": null,
"documentsCombinedUri": null,
"certificateUri": null,
"templatesUri": null,
"messageLock": null,
"recipientsLock": null,
"useDisclosure": null,
"emailSettings": null,
"purgeState": null,
"lockInformation": null,
"is21CFRPart11": null
}
201 Created
Content - Type: application / json;
charset = utf - 8 {
"envelopeId": "555555555555555555",
"uri": "/envelopes/adsfadsfadsfasdfadsfadsfasdf",
"statusDateTime": "2016-06-30T22:22:31.5900000Z",
"status": "sent"
}
其他:
不使用模板时,我可以附加多个文档。当使用模板时,我不能。即使我在模板中添加相同数量的文档,它也不起作用
我已经能够做到这一点,但它似乎不正确。我能够使它工作的方法是使用复合模板和内联模板。正如Ergin在他的评论中所说,平台对传入的API调用作出反应,因此您需要显示传入的API请求本身以获得最佳答案 这是一本书 同时,以下是一些想法:
根据您更新的帖子,该帖子指定您可以使用多个文档,但在通过模板发送时不能使用,因此系统按照设计运行,这里没有bug 我认为您基本上已经回答了自己的问题,如果您想将一个模板和其他文档组合在一起,或者两个或更多模板组合在一起,或者模板和文档的任何其他组合,那么您需要使用
compositeTemplates
节点
以下是复合模板的一些附加资源:
- (请参阅下面的复合模板部分)
- (请参见结合了两个模板的第三个示例)
如果您可以发布VB代码生成的原始JSON(您可以编辑任何私有信息,如果存在的话),这将变得容易得多。您可以通过帐户首选项或Fiddler之类的工具使用请求日志记录来捕获原始API请求。@Ergin请参阅更新的问题。非常感谢。我认为系统的运行符合预期,请参见下面我的答案。复合模板确实是组合模板和文档的方法。我能够获得日志记录。请参阅更新的答案。非常感谢。我想你对这里有些了解。。。文件不是很大,所以不确定发生了什么,但创建为草稿并一次添加一个文档似乎到目前为止还有效。会随着我的继续而更新的。这是可行的,但会带来另一个问题。我的签名标签随后被破坏。将模板和文档组合在一起是一件棘手的事情。您可能希望只指定通话中的所有内容,而不使用任何模板。请参阅我在回答中提到的多文档配方。
Private Function ReadContent(ByVal fileName As String) As Byte()
Dim tempByte() As Byte = Nothing
If String.IsNullOrEmpty(fileName) Then
Throw New ArgumentNullException("FileName Not Provided")
Return Nothing
End If
Try
Dim fileInfo As New FileInfo(fileName)
Dim numBytes As Long = fileInfo.Length
Dim fStream As New FileStream(fileName, FileMode.Open, FileAccess.Read)
Dim binaryReader As New BinaryReader(fStream)
tempByte = binaryReader.ReadBytes(Convert.ToInt32(numBytes))
fileInfo = Nothing
numBytes = 0
fStream.Close()
fStream.Dispose()
Return tempByte
Catch ex As Exception
Return Nothing
End Try
End Function