GetDocument

Description Retrieves the document content as a byte array in an octet-stream response.
Method Type POST
URL api/document/document
Parameters
Name Type Description
DocumentID Object

The specified document’s DocumentID.

The DocumentID can be any object, for example an absolute path of a file, or a database row ID. The specified Content-Engine will interpret the DocumentID and serve the document.

CE (Optional) String

The Specified Content-Engine.

Possible values:

0: Default Content-Engine (default)

1: FileEngine

2: DatabaseEngine

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

}

});

})

};