GetDocument
| Description | Retrieves the document content as a byte array in an octet-stream response. | |||||||||
| Method Type | POST | |||||||||
| URL | api/document/document | |||||||||
| Parameters |
|
|||||||||
| Response Type | application/octet-stream | |||||||||
| Return values | The byte array of the document. |
Programming notes
None
Example
| JavaScript Example |
|
// Promise function to retrieve the document content from the Content-Engine const GetDocument = (id) => { return new Promise((resolve, reject) => { $.ajax({ type: "POST", url: API_GetDocument, /* api/document/document */ cache: false, xhrFields: { responseType: 'blob' }, data: { DocumentID: id }, success: function (r) { // Setup the Blob type according to the expected document type. // You can use the GetFileType API to retrieve the document type. var blob = new Blob([r], { type: 'application/pdf' }); let href = URL.createObjectURL(blob); resolve(href); // return promise with the blob URL pointing to the document content }, error: function (xhr, textStatus, message) { // handle error console.log("Error while getting the document content: " + message) reject(0); // reject promise } }); }) }; |
