有没有办法使用docusign api创建模板

时间:2014-03-06 10:24:21

标签: docusignapi

我正在使用其余的api(在php-codeigniter中)进行docusign。目前我正在从demo.docusign.net创建模板。是否有任何API调用通过上传文档从我的网站创建docusign模板?

3 个答案:

答案 0 :(得分:3)

是,

VERB为POST,URI为{vx}/accounts/{accountid}/templates

文档Here

DocuSign REST API操作位于https://www.docusign.net/restapi/help#

此端点信息也包含在此其他Stack Overflow Question What WSDL URL to use for SOAP using Sandbox account?

DocuSign在线帮助文​​档位于https://docs.docusign.com/esign

答案 1 :(得分:2)

以下是此帖here的解决方案。我上传了一个HTML文件作为签名文档的模板。这样可以让您了解如何将文件上传为模板。

// 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";

如果您需要更深入的信息,可以访问docusign page

答案 2 :(得分:1)

如果不清除,您还可以在通过API创建信封时上传文档。因此,如果您实际上不需要,可以绕过创建模板。