需要Docusign API端点 [英] Need Docusign API Endpoint

查看:67
本文介绍了需要Docusign API端点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文档 https://docs.docusign.com/esign/guide /authentication/legacy_auth.html 不起作用。我已经花费了至少2个小时来尝试使这些说明生效。

The docs https://docs.docusign.com/esign/guide/authentication/legacy_auth.html do not work. I've spent at least 2 hours trying to get these instructions to work. Either your instructions are wrong, or they have a bug on their site.

我四天前开了一个有支持的案件,但他们没有回应。我正忙于实现这一目标。有人知道如何获取此网址。

I opened a case with support 4 days ago, but they have not responded. I am on a time crunch to get this going. Does anyone know how to get this url.

这是我的C#代码:

    ApiClient apiClient = new ApiClient("https://www.docusign.net/restapi");
    DocuSign.eSign.Client.Configuration.Default.ApiClient = apiClient;
    DocuSignHeader myHeader = new DocuSignHeader()
    {
    Username = ConfigurationManager.AppSettings["DocuSignUsername"],
    Password = ConfigurationManager.AppSettings["DocuSignPassword"],
    IntegratorKey = ConfigurationManager.AppSettings["DocuSignIntegratorKey"],
    };
    DocuSign.eSign.Client.Configuration.Default.AddDefaultHeader("X-DocuSign-Authentication", JsonConvert.SerializeObject(myHeader));
    AuthenticationApi authApi = new AuthenticationApi();
    LoginInformation loginInfo = authApi.Login();
    LoginAccount myAccount = loginInfo.LoginAccounts[0];
.. create envelope here..
   EnvelopesApi envelopesApi = new EnvelopesApi(GetBasePath(myAccount.BaseUrl));
   EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(myAccount.AccountId, envDef);

GetBasePath()的目的是剥离 restapi之后的所有内容,因此该URL是正确的

The purpose of GetBasePath() is to strip off everything after 'restapi', so the url is correct.

推荐答案

DocuSign实时生产系统具有多个帐户子域,而演示系统仅使用演示。例如,在生产中,可能的站点是 www na2 na3 eu

The DocuSign live production system has multiple account sub-domains as opposed to the demo system which only uses demo. For instance, in production the possible sites are www, na2, na3, eu.

您的集成代码需要解析<$ c $的子域从您的身份验证请求返回的c> baseUrl ,并使用该新的子域重新配置 apiClient

Your integration code needs to parse the sub-domain of the baseUrl that is returned from your authentication request and re-configure the apiClient with that new sub-domain.

您似乎正在使用DocuSign SDK,自述文件中有一条注释对此进行了解释:

It looks like you are using a DocuSign SDK, there's a note in the readme that explains this:

身份验证

使用旧报头身份验证的服务集成

Service Integrations that use Legacy Header Authentication

(传统标头身份验证使用X-DocuSign-Authentication标头。)

(Legacy Header Authentication uses the X-DocuSign-Authentication header.)

使用Authentication:登录方法检索帐号和该帐户的baseUrl。用于生产的登录方法的URL是www.docusign.net,用于开发人员沙箱的是demo.docusign.net。 baseUrl字段是loginAccount对象的一部分。请参阅文档和loginAccount对象

Use the Authentication: login method to retrieve the account number and the baseUrl for the account. The url for the login method is www.docusign.net for production and demo.docusign.net for the developer sandbox. The baseUrl field is part of the loginAccount object. See the docs and the loginAccount object

在生产中,所选帐户的baseUrl将以na1,na2,na3,eu1或其他开头。使用返回的baseUrl创建basePath(请参阅下一步。)将basePath用于所有后续API调用。

The baseUrl for the selected account, in production, will start with na1, na2, na3, eu1, or something else. Use the baseUrl that is returned to create the basePath (see the next step.) Use the basePath for all of your subsequent API calls.

如登录方法所返回, baseUrl包含API版本和帐户ID。分割字符串以获取basePath,仅获取服务器名称和api名称。例如,您将收到 https://na1.docusign.net/restapi/v2/accounts / 123123123 。您只需要 https://na1.docusign.net/restapi
使用实例化SDK basePath。例如,ApiClient apiClient = new ApiClient(basePath);

As returned by login method, the baseUrl includes the API version and account id. Split the string to obtain the basePath, just the server name and api name. Eg, you will receive https://na1.docusign.net/restapi/v2/accounts/123123123. You want just https://na1.docusign.net/restapi Instantiate the SDK using the basePath. Eg ApiClient apiClient = new ApiClient(basePath);

使用Configuration.Default.AddDefaultHeader

Set the authentication header as shown in the examples by using Configuration.Default.AddDefaultHeader

参考: C#SDK

代码示例

这是相应的C#代码正是上面提到的内容(即,删除baseUrl的子域并重新配置apiClient):

Here is the corresponding C# code to do exactly what is mentioned above (ie strip the sub-domain of the baseUrl and re-configure the apiClient):

// Update ApiClient with the new base url from login call
string[] separatingStrings = { "/v2" };
apiClient = new ApiClient(loginInfo.LoginAccounts[0].BaseUrl.Split(separatingStrings, StringSplitOptions.RemoveEmptyEntries)[0]);

这篇关于需要Docusign API端点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆