有没有办法使用docusignapi创建模板

有没有办法使用docusignapi创建模板,docusignapi,Docusignapi,我正在使用RESTAPI(在php codeigniter中)进行docusign。目前我正在从demo.docusign.net创建模板。是否有API调用通过上载文档从我的站点创建docusign模板?是 动词是POST,URI是{vx}/accounts/{accountid}/templates 文件 DocuSign REST API操作位于 端点信息也包含在另一个堆栈溢出问题中 DocuSign联机帮助文档位于如果不清楚,您也可以在通过API创建信封时上载文档。因此,如果您实际上不需要

我正在使用RESTAPI(在php codeigniter中)进行docusign。目前我正在从demo.docusign.net创建模板。是否有API调用通过上载文档从我的站点创建docusign模板?

动词是
POST
,URI是
{vx}/accounts/{accountid}/templates

文件

DocuSign REST API操作位于

端点信息也包含在另一个堆栈溢出问题中


DocuSign联机帮助文档位于

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

这是我在本文中提出的解决方案。我上传了一个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";

如果您需要更深入的信息,可以访问文档签名。

谢谢David。我让它工作了。很抱歉还有一个疑问。是否有任何api可以删除这些模板?我找不到用于从此列表中删除模板的api。是的,尼米莎。通过soap,您可以使用delete信封(我知道它是一个模板),但目前我看不到REST中的等效项,因为模板上的delete动词只允许从共享模板的组中删除,而信封上的delete用于项目,而不是信封。我在REST上对模板和带有模板ID的信封都进行了测试,结果返回了404。所以现在,SOAP是您唯一的方法(简单调用和xml有效负载),您是否介意为此创建一个单独的问题,以便我们能够回答它,并且它是可搜索的?:-)如果你要说的只是“看这个,这会给你一些想法”,那么问题可能是你所指问题的重复,在这种情况下,你应该标记/投票以重复结束,或者问题是相关的,但不是完全重复的,在这种情况下,这不会回答问题,应该是一个评论。