【发布时间】: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