i am using the rest api (in php-codeigniter) for docusign. Currently i am creating templates from demo.docusign.net. Is there any API call to create a docusign template from my site by uploading a document ?
3 Answers
Yes,
The VERB is POST
and the URI is {vx}/accounts/{accountid}/templates
Documentation Here
The DocuSign REST API Operations is at https://www.docusign.net/restapi/help#
Also the endpoint information is covered in this other Stack Overflow Question What WSDL URL to use for SOAP using Sandbox account?
The DocuSign Online Help Documentation is at https://docs.docusign.com/esign

- 7,295
- 2
- 21
- 43

- 1,554
- 1
- 13
- 23
-
Thanks David. I got it working. Sorry. One more doubt .. . Is there any api to delete those templates? I couldn't find the api to delete a template from this list. https://www.docusign.net/restapi/help# . – nimisha Mar 10 '14 at 11:51
-
Yes, Nimisha. Via soap, you use the delete envelope (I know it is a template) but at current I don't see the equivalent in REST as the Delete verb on templates only allows removal from the group the template is shared from, and delete on envelope is for items but not the envelope. I did try it on REST for both templates and envelopes with the template ID and it just returned a 404 as expected. So at this time, SOAP is your only way (simple call and xml payload) Also, would you mind creating a separate question for this so we can answer it and it is searchable? :-) – David W Grigsby Mar 13 '14 at 02:11
Here is my solution from this post here. I uploaded an HTML file as a template for the signature document. This will able to give you an idea how to upload files as template.
// set recipient information
$recipientName = "";
$recipientEmail = "";
// configure the document we want signed
$documentFileName = "/../document.html";
$documentName = "document.html";
// instantiate a new envelopeApi object
$envelopeApi = new DocuSign\eSign\Api\EnvelopesApi($this->getApiClient());
// Add a document to the envelope
$document = new DocuSign\eSign\Model\Document();
$document->setDocumentBase64(base64_encode(file_get_contents(__DIR__ . $documentFileName)));
$document->setName($documentName);
$document->setFileExtension('html');
$document->setDocumentId("2");
// Create a |SignHere| tab somewhere on the document for the recipient to sign
$signHere = new \DocuSign\eSign\Model\SignHere();
$signHere->setXPosition("100");
$signHere->setYPosition("100");
$signHere->setDocumentId("2");
$signHere->setPageNumber("1");
$signHere->setRecipientId("1");
// add the signature tab to the envelope's list of tabs
$tabs = new DocuSign\eSign\Model\Tabs();
$tabs->setSignHereTabs(array($signHere));
// add a signer to the envelope
$signer = new \DocuSign\eSign\Model\Signer();
$signer->setEmail($recipientEmail);
$signer->setName($recipientName);
$signer->setRecipientId("1");
$signer->setTabs($tabs);
$signer->setClientUserId("1234"); // must set this to embed the recipient!
// Add a recipient to sign the document
$recipients = new DocuSign\eSign\Model\Recipients();
$recipients->setSigners(array($signer));
$envelop_definition = new DocuSign\eSign\Model\EnvelopeDefinition();
$envelop_definition->setEmailSubject("[DocuSign PHP SDK] - Please sign this doc");
// set envelope status to "sent" to immediately send the signature request
$envelop_definition->setStatus("sent");
$envelop_definition->setRecipients($recipients);
$envelop_definition->setDocuments(array($document));
// create and send the envelope! (aka signature request)
$envelop_summary = $envelopeApi->createEnvelope($accountId, $envelop_definition, null);
echo "$envelop_summary\n";
If you need more in depth information you can visit the docusign page.

- 1
- 1

- 1,797
- 3
- 21
- 31
-
If all you have to say is "see this, this will give some idea" chances are either the question is a duplicate of the question you're referring to in which case you should flag/vote to close as duplicate, or the question is related but not exact duplicate in which case this won't answer the question and should be a comment. – T J Jun 28 '16 at 10:44
In case it isn't clear, you can also upload a document when creating an envelope via the API. Thus you can bypass creating a template if you don't actually need one.

- 698
- 3
- 8