Reputation: 31
I've got some code that work like a charm to create an enveloppe and add recipients using the Envelopes: create method.
Now i need to start using EnvelopeRecipients: create method to add some signers in an already created enveloppe. Doc : https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeRecipients/create
My code is working : i can create a new signer, no error is returned by the API but all the tags i try to add for this new user are not set.
I'am using the PHP SDK but i will just show you the data send by the SDK to the API.
{
"signers": [
{
"clientUserId": 3,
"email": "[email protected]",
"name": "Fake Signer",
"recipientId": 3,
"routingOrder": 0,
"tabs": {
"dateSignedTabs": [
],
"signHereTabs": [
{
"documentId": 1,
"pageNumber": 1,
"xPosition": 100,
"yPosition": 100
}
],
"textTabs": [
]
}
}
]
}
The new user is created. All the properties are correct except for the tabs property : tabs = null I double check it and i'am sure the tabs doesn't exist in the doc. Same issue with all tabs type. If this matter, my envelope status is sent.
Not sure if this issue come from my code, from the SDK or from the API.
Upvotes: 0
Views: 80
Reputation: 31
Issue solved : I don't understand why the method :
POST /v2/accounts/{accountId}/envelopes/{envelopeId}/recipients is not working but i've got the same result without error by using : PUT /v2/accounts/{accountId}/envelopes/{envelopeId} https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/update
I suspect a bug in the API or in the PHPSDK regarding tabs in the first method.
Final working code :
$envelopeApi = new DS\Api\EnvelopesApi($this->apiClient);
//TEST
$envelope = new DS\Model\Envelope();
$addRecipients = new DS\Model\Recipients();
$fakeSigner = new DS\Model\Signer();
$fakeSigner->setName('Fake Signer');
$fakeSigner->setEmail('[email protected]');
$fakeSignerId = 50;
$fakeSigner->setClientUserId($fakeSignerId);
$fakeSigner->setRecipientId($fakeSignerId);
$fakeSigner->setRoutingOrder(1);
$fakeSignerTabs = new DS\Model\Tabs();
$fakeSignHere = $tab = new DS\Model\SignHere();
$fakeSignHere->setXPosition(100);
$fakeSignHere->setYPosition(100);
$fakeSignHere->setDocumentId(1);
$fakeSignHere->setPageNumber(1);
$fakeSignerTabs->setSignHereTabs(array($fakeSignHere));
$fakeSignerTabs->setDateSignedTabs(array());
$fakeSignerTabs->setTextTabs(array());
$fakeSigner->setTabs($fakeSignerTabs);
$addRecipients->setSigners(array($fakeSigner));
$envelope->setRecipients($addRecipients);
$updateOptions = new DS\Api\EnvelopesApi\UpdateOptions();
$updateOptions->setAdvancedUpdate('true');
try{
$summary = $envelopeApi->update($this->accoundId, $envelopeId, $envelope, $updateOptions);
var_dump($summary);
} catch (DS\ApiException $e){
$this->logger->error('Error while calling Docusign :' . $e->getResponseBody()->errorCode . " " . $e->getResponseBody()->message);
throw $e;
}
Hope it help someone.
Upvotes: 0