Document Information

Fetch a Specific Document

A client may need to get information about a specific document in the repository. This may be done using the following functions depending on the information available:

get_document_detail(session, document_id, detail) :kt_document_detail
get_document_detail_by_title(session, folder_id, title, detail) : kt_document_detail
get_document_detail_by_filename(session, folder_id, filename, detail) :kt_document_detail
get_document_detail_by_name(session, folder_id, name, what, detail) : kt_document_detail
Field Type Description
sessionStringThe session token.
document_id IntegerThe ID of the document.
folder_idIntegerThe ID of the parent / containing folder. Provides a starting point in finding the document so that the document has a relative starting position. This may be set to 1, the root folder id, and a full path may then be used in the filename.
titleStringThe title or display name of the document.
filenameStringThe filename of the document.
nameStringEither the filename or the title of the document. The what parameter indicates which is to be used.
whatStringValues are either T or F. Indicates if name is the title “T” or the filename “F”
detailStringAll functions take a detail field that indicate how much information may be returned in the kt_document_detail structure. Leaving the detail field blank will return only the core document fields. This string may be composed of any combination of the letters M, L, T, V and/or H.

The detail string may be composed of the values:

  • 'M' to include metadata
  • 'L' to include links (only v3.7 and earlier)
  • 'T' to include workflow transitions
  • 'V' to include version history
  • 'H' to include transaction history

By leaving the detail parameter blank, only the core document fields will be returned.

Sample psuedo code using get_document_detail

response = webservice.get_document_detail('3a598320171890920a6b13f7fcc69dce', 1, 'MLTVH') 
if response.status_code != 0 
    raise 'Could not get document detail for document. Reason: ' + response.message 
end 
print 'Document Title: ' + response.title 
print 'Document Id: ' + response.document_id

Sample psuedo code using get_document_detail_by_filename

response = webservice.get_document_detail_by_filename('3a598320171890920a6b13f7fcc69dce', 1, '/invoice/inv-2008-01.xls', '') 
if response.status_code != 0 
    raise 'Could not get document detail for document. Reason: ' + response.message 
end 
print 'Document Title: ' + response.title 
print 'Document Id: ' + response.document_id

Note that all information is applicable to the last checked-in version of the document.

Fetch Document Metadata

The metadata or properties associated with the document - fields, fieldsets and values.

get_document_metadata(session, document_id) : kt_metadata_response
Field Type Description
sessionStringThe session token.
document_idIntegerThe ID of the document
Response

A kt_metadata_response object is returned.

Fetch Document History

The document history is composed of the version history (both metadata and content updates) and the transaction history (actions taken on the document).

get_document_transaction_history (session, document_id) : kt_document_transaction_history_response
get_document_version_history (session, document_id) : kt_document_version_history_response
Field Type Description
sessionStringThe session token.
document_idIntegerThe ID of the document
Response

The transaction history is returned as a kt_document_transaction_history_response object. The version history is returned as a kt_document_version_history_response object.

Fetch Workflow Information

If the document is in a workflow these functions can be used to get the current state of the workflow and the available transitions for the state.

get_document_workflow_state (session, document_id) : kt_response 
get_document_workflow_transitions (session, document_id) : kt_workflow_transitions_response
Field Type Description
sessionStringThe session token.
document_idIntegerThe ID of the document

This is described in more detail in the |workflow actions section.

Response

The workflow state is returned as a standard kt_response object. The available transitions are returned as a kt_workflow_transitions_response object.