【问题标题】:Docusign c# sdk error calling getDocument and ListDocumentsDocusign c# sdk错误调用getDocument和ListDocuments
【发布时间】:2018-03-18 17:36:07
【问题描述】:

我正在尝试使用 C# sdk 从我的 Docusign 帐户获取已签名的所有文档。 到目前为止,我可以登录,但是当我尝试检索文档列表或一个文档时,它总是给我 DocuSign.eSign.Client.ApiException: 'Error calling ListDocuments: 'DocuSign.eSign.Client.ApiException: 'Error calling GetDocument: ' 两者都具有 404 状态。

这里是代码

    static void Main(String[] args)
    {
        string envelopeId = "my_envelop_id";
        string accountId = Init();

        EnvelopesApi envelopesApi = new EnvelopesApi();

        //Here is where the exception is thrown
        EnvelopeDocumentsResult docsList = envelopesApi.ListDocuments(accountId, envelopeId);

        // GetDocument() API call returns a MemoryStream
        //var docStream = envApi.GetDocument(accountId, envelopeId, "my_document_id");
    }

    public string Init()
    {
        // initialize client for desired environment (for production change to www)
        ApiClient apiClient = new ApiClient(_baseUri);
        Configuration.Default.ApiClient = apiClient;

        Configuration.Default.AddDefaultHeader("X-DocuSign-Authentication", _authHeader);

        // we will retrieve this from the login API call
        string accountId = null;

        // login call is available in the authentication api 
        AuthenticationApi authApi = new AuthenticationApi();
        LoginInformation loginInfo = authApi.Login();

        // parse the first account ID that is returned (user might belong to multiple accounts)
        accountId = loginInfo.LoginAccounts[0].AccountId;
        urlCAC = loginInfo.LoginAccounts[0].BaseUrl;

        // Update ApiClient with the new base url from login call
        apiClient = new ApiClient(loginInfo.LoginAccounts[0].BaseUrl);

        return accountId;
    }

任何帮助将不胜感激我非常卡住!提前致谢

更新

我终于让它工作了。问题出在apiClient = new ApiClient(loginInfo.LoginAccounts[0].BaseUrl); 行。当我删除这条线时一切正常。感谢大家的回复。

【问题讨论】:

  • accountId 是否来自 Init() 方法? _authHeader 中使用的用户也是您用来从中提取文档的信封Id 的所有者吗?

标签: c# docusignapi


【解决方案1】:

问题出在var envApi = new EnvelopesApi(urlCAC);线上

像这样将 baseURL 插入 EnvelopesAPI 对象是不正确的。您可以在 Fiddler 中看到这一点 - Visual Studio 将尝试调用 GET https://demo.docusign.net/restapi/v2/accounts/{{accountId}}/v2/accounts/{{accountId}}/envelopes/{{envelopeId}}/documents HTTP/1.1 - 包括两次 /v2/accounts/{{accountID/}}

【讨论】:

  • 感谢您的回复,我删除了 urlCAC 参数但结果相同:(
  • 看起来你在第 5 行声明了新的 API 对象 envApi,然后在下一行 6 中你调用了信封 API 作为 API 对象。如果您将它们对齐以匹配,它会起作用吗?
  • 不,它不起作用,这是我尝试使用信封的两种情况的示例,我将更新问题以使其更清楚,再次感谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-08
相关资源
最近更新 更多