Reputation: 15
I'm trying to make a API call to the eSignature REST API Envelopes: listStatus (as shown here)
However, I get ERROR 400 Bad Request and the following:
{
"errorCode": "UNSPECIFIED_ERROR",
"message": "Object reference not set to an instance of an object."
}
Even trying it in DocuSign's API explorer I get the same error. The error seems to be pointing to a issue with how the request body is formed. DocuSign suggests this,
{
"envelopeIds": [
"44c5ad6c-xxxx-xxxx-xxxx-ebda5e2dfe15",
"8e26040d-xxxx-xxxx-xxxx-1e29b924d237",
"c8b40a2d-xxxx-xxxx-xxxx-4fe56fe10f95"
]
}
however, if I use "envelopeIds" in the body instead I get:
{
"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."
}
replacing "envelopeIds" with "envelope_ids" I get:
Response:
{
"errorCode": "UNSPECIFIED_ERROR",
"message": "Object reference not set to an instance of an object."
}
and even using a comma separated list like, I get the same error:
Body:
{ "envelopeIds": "44c5ad6c-xxxx-xxxx-xxxx-ebda5e2dfe15,8e26040d-xxxx-xxxx-xxxx-1e29b924d237"}
Response:
{
"errorCode": "UNSPECIFIED_ERROR",
"message": "Object reference not set to an instance of an object."
}
Any help would be much appreciated. I have tried this using both postman and DocuSign's API explorer.
Upvotes: 1
Views: 493
Reputation: 697
If you're using their PHP SDK, here is the code :
//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);
As found in @JD Brennan 's answer, you must specify that you'll send your ids in the request body, and it is done with a ListStatusOption object.
Upvotes: 1
Reputation: 1112
You need to include ?envelope_ids=request_body
in the URL.
Then it should work with the body:
{
"envelopeIds": [
"44c5ad6c-xxxx-xxxx-xxxx-ebda5e2dfe15",
"8e26040d-xxxx-xxxx-xxxx-1e29b924d237",
"c8b40a2d-xxxx-xxxx-xxxx-4fe56fe10f95"
]
}
Upvotes: 4