SpaceApple SpaceApple - 13 days ago 5
C# Question

Docusign C# CreateEnvelope

I have called the demo api server and I managed to execute a call successfully and managed to sign some documents. I am now moving to the production api and what I understand is that I call the login service and get the baseURL for the new api to send my Envelope but when I do that I keep getting an error when trying to send it off. The exception comes back as :

Error calling CreateEnvelope:


Here is my code when calling the Envelope

ApiClient apiClient = new ApiClient(loginAccount.BaseUrl);
Configuration cfi = new Configuration(apiClient);
string authHeader = "{\"Username\":\"" + loginAccount.Email + "\", \"Password\":\"" + docusignPassword + "\", \"IntegratorKey\":\"" + INTEGRATOR_KEY + "\"}";
cfi.AddDefaultHeader("X-DocuSign-Authentication", authHeader);
EnvelopesApi envelopesApi = new EnvelopesApi(cfi);
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(loginAccount.AccountId, envDef);


The moment it his CreateEnvelope it will throw an exception.

Answer

I found the solution to this.

Basically you need split the BaseUrl that gets returned from the login api.

BaseUrl = https://na1.docusign.net/restapi/v2/accounts/123123123. SplitUrl = https://na1.docusign.net/restapi

The first url is what the login api returns to you. You would then strip out the v2/accounts/123123123 then use that as the new url for the createEnvelope.

Comments