我正在尝试对 eSignature REST API 信封进行 API 调用:listStatus(如此处所示)
但是,我收到 ERROR 400 Bad Request 和以下信息:
{
"errorCode": "UNSPECIFIED_ERROR",
"message": "Object reference not set to an instance of an object."
}
即使在 DocuSign 的 API 资源管理器中尝试,我也会遇到同样的错误。该错误似乎表明请求正文的形成方式存在问题。 DocuSign 建议这样做,
{
"envelopeIds": [
"44c5ad6c-xxxx-xxxx-xxxx-ebda5e2dfe15",
"8e26040d-xxxx-xxxx-xxxx-1e29b924d237",
"c8b40a2d-xxxx-xxxx-xxxx-4fe56fe10f95"
]
}
但是,如果我在正文中使用“envelopeIds”,我会得到:
{
"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."
}
用“envelope_ids”替换“envelopeIds”我得到:
回应:
{
"errorCode": "UNSPECIFIED_ERROR",
"message": "Object reference not set to an instance of an object."
}
甚至使用逗号分隔列表,我也得到同样的错误:
身体:
{ "envelopeIds": "44c5ad6c-xxxx-xxxx-xxxx-ebda5e2dfe15,8e26040d-xxxx-xxxx-xxxx-1e29b924d237"}
回应:
{
"errorCode": "UNSPECIFIED_ERROR",
"message": "Object reference not set to an instance of an object."
}
任何帮助将不胜感激。我已经使用邮递员和 DocuSign 的 API 浏览器尝试过此操作。
您需要在 URL 中包含
?envelope_ids=request_body
。
然后它应该与身体一起工作:
{
"envelopeIds": [
"44c5ad6c-xxxx-xxxx-xxxx-ebda5e2dfe15",
"8e26040d-xxxx-xxxx-xxxx-1e29b924d237",
"c8b40a2d-xxxx-xxxx-xxxx-4fe56fe10f95"
]
}
如果您使用他们的 PHP SDK,这里是代码:
//Get envelopes API
$envelopesApi = new EnvelopesApi($this->docusignClient);
//Create ListStatusOptions object for the listStatus endpoint
$lso = new EnvelopesApi\ListStatusOptions();
//Important : Specify that the envelope ids will be in the request body
$lso->setEnvelopeIds('request_body');
//Call list status
$envelopesInformation = $envelopesApi->listStatus(
account_id:$this->accountId,
//The request body, as a new EnvelopeIdsRequest object, whith the values as an array of strings
envelope_ids_request: new EnvelopeIdsRequest(['envelope_ids'=>$toCheck]),
//The carefuly crafted ListStatusOptions object
options: $lso);
如 @JD Brennan 的答案所示,您必须指定在请求正文中发送您的 ID,并且这是通过 ListStatusOption 对象完成的。