在DocuSign.eSign.Api.EnvelopesApi上的INVALID_REQUEST_PARAMETER

时间:2018-08-01 21:01:25

标签: c# docusignapi

我遇到了与问题INVALID_REQUEST_PARAMETER on listStatus中所述完全相同的错误

但是,与该OP不同,我不是直接使用REST API,而是使用https://www.nuget.org/packages/DocuSign.eSign.dll

中的C#SDK

看来,SDK包装器不包括上面链接文章中答案所描述的querystring参数。除了等待DocuSign修复其SDK之外,还有其他解决方法吗?在什么地方为他们的SDK提交错误?

每个注释,下面是一个代码示例:

var envelopesApi = new DocuSign.eSign.Api.EnvelopesApi();
var envelopeIds = incentivesWithPendingOffers.Select(i => i.new_OfferLetterEnvelopeID).ToList();
var envelopeInfos = await envelopesApi.ListStatusAsync(_tokenAccountId, new EnvelopeIdsRequest(envelopeIds), null);

正在运行提琴手来捕获SDK发出的出站REST调用,我看到了:

PUT https://demo.docusign.net/restapi/v2/accounts/[ REDACTED ]/envelopes/status HTTP/1.1
X-DocuSign-SDK: C#
Authorization: Bearer [ REDACTED ]
Accept: application/json
User-Agent: Swagger-Codegen/2.1.0/csharp
Content-Type: application/json
Host: demo.docusign.net
Content-Length: 96
Accept-Encoding: gzip, deflate

{"envelope_ids":["1d324bac-60ea-44b5-9b60-a5de14af3beb","5431d728-4918-4218-9c12-765b1c914724"]}

返回以下响应(SDK变成.NET异常):

HTTP/1.1 400 Bad Request
Cache-Control: no-cache
Content-Length: 238
Content-Type: application/json; charset=utf-8
X-DocuSign-TraceToken: [ REDACTED ]
Date: Wed, 01 Aug 2018 20:43:58 GMT
Strict-Transport-Security: max-age=31536000; includeSubDomains

{
  "errorCode": "INVALID_REQUEST_PARAMETER",
  "message": "The request contained at least one invalid parameter. Query parameter 'from_date' must be set to a valid DateTime, or 'envelope_ids' or 'transaction_ids' must be specified."
}

2 个答案:

答案 0 :(得分:1)

编写上一个答案时,SDK不支持将信封ID列表放入呼叫正文中。从客户端版本3.1.3开始,该功能现在可用。

        List<string> envelopeIds = new List<string>();
        envelopeIds.Add("2b62eb63-784a-4228-be02-876762ea6661");
        envelopeIds.Add("406a9a15-c8e9-4227-8dd2-bd9a5318d4fd");

        EnvelopeIdsRequest envelopeIdsRequest = new EnvelopeIdsRequest();
        envelopeIdsRequest.EnvelopeIds = envelopeIds;

        ListStatusOptions options =  new ListStatusOptions();
        options.envelopeIds = "request_body"; //the Options value controls the query string parameter

        EnvelopesInformation envelopesInfo = envelopesApi.ListStatus(accountId, envelopeIdsRequest, options);

答案 1 :(得分:0)

我无法通过SDK使用envelope_ids=request_body参数,但可以一次获取多个信封的状态。只要您不要求太多的信封ID以至于URL溢出,这将是一个可行的解决方法。

        EnvelopesApi.ListStatusChangesOptions lsco = new EnvelopesApi.ListStatusChangesOptions
        {
            envelopeIds = "fdd1122a-9c1b-4eef-9e24-25bb2cdf2eb2, fe1cb500-6a4c-4328-bf24-55806434852f, 5b1d3828-f8cd-4bba-87f0-538cb920db96"
        };

        EnvelopesInformation listStatusChanges = envelopesApi.ListStatusChanges(accountId, lsco);

导致对

的API调用

GET https://demo.docusign.net/restapi/v2/accounts/{{accountId}}/envelopes?envelope_ids=fdd1122a-9c1b-4eef-9e24-25bb2cdf2eb2%2C%20fe1cb500-6a4c-4328-bf24-55806434852f%2C%205b1d3828-f8cd-4bba-87f0-538cb920db96