Latika
Latika

Reputation: 57

preview the document from a template using REST APIs

We have multiple templates each with a single document in DocuSign. For this we designed an interface in our application, listing all the templates. Before sending the selected templates (and the documents), is it possible to preview the document from the template (not a page image)?

NOTE: Have used RESTFul APIs.

Upvotes: 0

Views: 368

Answers (3)

jayson.centeno
jayson.centeno

Reputation: 835

You can use latest Docusign API v2.1

I'm using C# Docusign SDK Docusign SDK

templateApi.GetDocumentAsync(accountId, templateId, "combined") -- will get all the documents in one single file as Stream

or

templateApi.GetDocumentAsync(accountId, templateId, documentdId) -- get only the single document as Stream

Upvotes: 0

Praveen
Praveen

Reputation: 457

Use '/envelopes/{templateid}/documents/{documentid}' REST API call to get the response, then set headers before printing the response to preview in the browser.

example:

header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="xyz.pdf"');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
print_r($response);//Print the response form the REST API.

Upvotes: 0

Luis
Luis

Reputation: 2702

You can access the PDF's stored in a template the same way you can download/access the PDF's within an envelope.

https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST%20API%20References/Get%20Template.htm?Highlight=template

Example GET URL for pulling the first document of a template: https://demo.docusign.net/restapi/v2/accounts//templates//documents/1

Upvotes: 1

Related Questions