The Download operation can be used to download a completed document and the associated completion report. The document must have a status of completed in order to call this operation.
The Download operation requires knowledge of the following:
- the Document ID of the document to download (this is returned as an element in the returned XML from a document submission operation)
- the AuthToken of the document to download (this is returned as an element in the returned XML from a document submission operation)
- the AssureSign account ContextIdentifier (this is exposed in the AssureSign administrative application account settings and serves to provide some security to the transaction)
The following optional parameters may also be specified:
- The Password is optional but will need to be specified when accessing any completed document that is protected by a password.
- If the document is configured to require a password for any access to the completed document, the appropriate document password must be provided with the request.
- If the document belongs to an envelope and the envelope is configured to require a password for any access to completed documents, the appropriate envelope password must be provided with the request.
- The DownloadType is optional and will default to Completed if not specified. Other possible options include Original and Interim. Note that the Interim document will not be available if the document has already been finalized.
<?xml version="1.0" encoding="utf-8"?> <Download xmlns="https://www.assuresign.net/Services/DocumentNOW/Download"> <DownloadRequest ContextIdentifier="06C4A84A-693C-46CB-8DF2-40A8215AA056" DocumentId="2CE11EF1-8938-DD11-8735-00065B8CE99B" AuthToken="8CC9A84B-693C-46CC-4342-40A8215AD76A" DownloadType="Completed" Password="password" /> </Download>
The SOAP Action header is
A response will return the DocumentId along with the actual file data for the completed document and the completion report.
The Download operation exposes two endpoints allowing it to be executed using either the W3C standard Message Transmission Optimization Mechanism (MTOM) protocol or not. If the MTOM endpoint is used, the returned completed document will be passed in its original raw binary form using XML-binary Optimized Packaging (XOP). If the non-MTOM endpoint is used, this document will be Base64-encoded and included directly in the response XML itself.
Sample XML (non-MTOM) returned by the Download operation is presented here:
<?xml version="1.0" encoding="utf-8"?> <DownloadResponse xmlns="https://www.assuresign.net/Services/DocumentNOW/Download"> <DownloadResult DocumentId="2CE11EF1-8938-DD11-8735-00065B8CE99B" DownloadType="Completed"> <FileData>RG9jdW1lbnQ=</FileData> <CompletionReportData>Q29tcGxldGlvblJlcG9ydA==</CompletionReportData> </DownloadResult> </DownloadResponse>
The DownloadResult should be checked for the presence of an Exceptions element, which may contain multiple DownloadException items.