I am creating demo application which Docusing pass file and signer dynamically, for that i need to use docusign templateid and pass details, i can pass file using templateid which signer already defined in template itself, now i want to pass multiple signer as dynamically.For that need to use templateRoles.
Dim json As New Chilkat.JsonObject
json.UpdateString("documents[0].name", "Testing.pdf")
json.UpdateString("documents[0].documentBase64", base64String)
json.UpdateString("documents[0].documentId", "2")
json.UpdateString("emailSubject", "DocuSign REST API Testing Sample")
json.UpdateString("emailBlurb", "Create and send an envelope from a document.")
json.UpdateString("templateId", "xxxxx-xxxxx-xxxxx-xxxx-xxxx")
json.UpdateString("templateRoles", "{roleName: Signer 1, name: Aravind, email: aravind@gmail.com, recipientId: 1}") ' Here i pass template role for signer 1, and also need to pass multiple signer.
json.UpdateString("status", "sent")
rest.AddHeader("X-DocuSign-Authentication", "{ ""Username"": ""DocuSign@example.com"", ""Password"":""DocuSign_password"", ""IntegratorKey"":""DocuSign_Integrator_Key"" }")
rest.AddHeader("Content-Type", "application/json")
rest.AddHeader("Accept", "application/json")
Dim sbRequestBody As New Chilkat.StringBuilder
json.EmitSb(sbRequestBody)
Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestSb("POST", "/restapi/v2.1/accounts/xxxxxx/envelopes", sbRequestBody, sbResponseBody)
Dim respStatusCode As Integer = rest.ResponseStatusCode
Here i paste code for ur reference, in that email,password,key everything i chanage,bcz it releted to security purpose. When i pass templateroles with values i get error.For above code i get following error return from api.
"errorCode":"INVALID_REQUEST_PARAMETER","message":"The request contained at least one invalid parameter. 'recipientId' not set for recipient."
Pls help me to solve this error.
Regards, Aravind
Try to remove recipientId: 1
from the JSON in line 8.
But I strongly suggest you reconsider your architecture choices. You are using legacy authentication which is not very secure.
You could use the C# SDK, which is a Nuget package and works just as well with VB.NET and that would help you make these calls without using JSON and also using modern OAuth that is much more secure.