SpaceApple SpaceApple - 1 year ago 177
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 Source

I found the solution to this.

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

BaseUrl = SplitUrl =

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download