Web service core document action
From KnowledgeTree Document Management Made Simple
Contents |
adding a document to the repository
Adding a document to the repository via web service methods can be done in two ways:
- a single web service request with the file content being base64 encoded
- a file is transmitted to the system via HTTP POST, and followed by a web service request
The first approach is very easy to implement, but has a drawback that it is not ideal when dealing with large files. Encoding of files is typically done in memory, so there may be significant overhead on the client and server. Furthermore, a base64 encoded file is about 1.5 times the original size. This not only is a drain on memory, but will impact on bandwidth utilisation.
The second approach performs much better with larger files, as HTTP POST requests can be dealt with quite efficiently, and there is no overhead of the encoding process.
adding a base64 encoded file to the repository
add_base64_document ( session : string, folder_id : integer, title : string, filename : string, document_type : string, base64 : string) : kt_document_detail
add_base64_document_with_metadata ( session : string, folder_id : integer, title : string, filename : string, document_type : string, base64 : string , metadata : kt_metadata_fieldsets, sysdata : kt_sysdata ) : kt_document_detail
adding a file with the 2 phase add process
add_document ( session : string, folder_id : integer, title : string, filename : string, document_type : string, temp_filename : string) : kt_document_detail add_document_with_metadata ( session : string, folder_id : integer, title : string, filename : string, document_type : string, temp_filename : string , metadata : kt_metadata_fieldsets, sysdata : kt_sysdata ) : kt_document_detail
Examples
An example of add_document in a Windows environment using C# (note the forward slashes):
kt_document_detail objDocument;
objDocument = objWebservice.add_document(strSession, 1, "wintest", "wintest.txt", "Default", "c:/ktdms/var/uploads/wintest.txt");
if (objDocument.status_code != 0)
{
Console.WriteLine("Error creating document: " + objDocument.message);
}
else
{
Console.WriteLine("Document created.");
}
Note: The file must already exist in the uploads directory.
modifying a document
checking-out a document with a base64 encoded result
checkout_base64_document ( session : string, document_id : integer, reason : string, download : boolean) : kt_document_detail
checking-out a document returning a download URL
checkout_document ( session : string, document_id : integer, reason : string, download : boolean) : kt_document_detail
checking-in a base64 encoded file
checkin_base64_document ( session : string, document_id : integer, filename : string, reason : string, base64 : string, major_update : boolean) : kt_document_detail
checkin_base64_document_with_metadata ( session : string, document_id : integer, filename : string, reason : string, base64 : string , metadata : kt_metadata_fieldsets, sysdata : kt_sysdata ) : kt_document_detail
checking-in a document with the 2 phase check-in process
checkin_base64_document ( session : string, document_id : integer, filename : string, reason : string, temp_filename : string, major_update : boolean) : kt_document_detail checkin_base64_document_with_metadata ( session : string, document_id : integer, filename : string, reason : string, temp_filename : string , metadata : kt_metadata_fieldsets, sysdata : kt_sysdata ) : kt_document_detail kt_metadata_fieldsets
cancel document modification
undo_document_checkout ( session : string, document_id : integer, reason : string) : kt_document_detail
downloading a document
downloading a document with a base64 encoded result
download_base64_document ( session : string, document_id : integer) : kt_response
downloading a document returning a download URL
download_document ( session : string, document_id : integer) : kt_response
updating document metadata
update_document_metadata ( session : string, document_id : integer, metadata : kt_metadata_fieldsets, sysdata : kt_sysdata ) : kt_document_detail
del.icio.us
reddit



