Skip to content

Instantly share code, notes, and snippets.

@Ergin008
Created February 9, 2018 05:50
Show Gist options
  • Save Ergin008/e4c538f2bc1190a05e960e6de4ff5a0c to your computer and use it in GitHub Desktop.
Save Ergin008/e4c538f2bc1190a05e960e6de4ff5a0c to your computer and use it in GitHub Desktop.
Get your DocuSign account's base URI and configure api client
AuthenticationApi authApi = new AuthenticationApi(apiClient);
LoginInformation loginInfo = authApi.login();
// note that the user might belong to multiple accounts, here we simply get first
String accountId = loginInfo.getLoginAccounts().get(0).getAccountId();
String baseUrl = loginInfo.getLoginAccounts().get(0).getBaseUrl();
// important: below code is required for production as the account sub-domains vary in the
// live system. We strip the base URI down to the form https://{env}.docusign.net/restapi
// then re-configure the api client with the new base path
String[] accountDomain = baseUrl.split("/v2");
apiClient.setBasePath(accountDomain[0]);
Configuration.setDefaultApiClient(apiClient);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment