Frame type 0 is used for generic remote procedure call - RPC. This method call is based on XML-RPC (s. http://www.xmlrpc.com/spec ). There is one xml file inside such frame which contains serialized procedure call.

This section contains description of various method which should be implemented. Most of them can be implemented by server and client, some of them only by one side. Method specification is written in pseudo "C" notation.

Every method call contains at least one parameter "ticker" - string. This parameter contains unique method call identification. Such identification can be used to pair together request and response. Every response have to also contain "ticker". Protocol is asynchronous and it is possible to send several independent requests at once.


First step is to introduce client to the server. There is method called hello.

Struct HelloData {
  // Application name
  string systemName;
  // Application version
  string systemVersion,
  // Array of supported options
  array options {
    struct Option {
      // Name of option
      string name;
      // Value of option
      string value;
    };
  };
};

HelloData hello(string ticker, HelloData data);


Returns informations about server and its protocol implementation.

Note

For compatibility with older clients server should be able to communicate without hello call. Older client will start communication with method authorize.

List of options:

Document is collection of pages and attributes. Protocol allows to transfer such documents.

Structure Document is usually used to send/receive document.

/* Document description */
Struct Document {
 /* Unique document identifacator */
 string documentId;

 /* Document version. Every document
  * can have more versions. */
 string version;

 /* Document version. This is identification
  * of subversion on server side. Client can
  * safely ignore this value and have to just
  * send it back to server. */
 string serverVersion;

 /* Document type. Document type define which
  * attributes are valid for document, how-to
  * display document and organize in logical
  * structure. Every document have to have
  * valid type. */
 string type;

 /* Document modification.
  * 0 – document is not modified
  * 1 – document attributes are modified */ 
 int modified;

 /* Document attributes. Array of document
  * attributes. Used attributes depens on document type */
 array attributes {
  /* Structure describes one attribute */
  struct Attribute {
   /* Attribute name */
   string name;
   /* Attribute value */
   string value; 
  }; 
 };

 /* Array of files, pages. */ 
 array files {
  /* Structure describing one file, page */
  struct File {
   /* Unique file (page) identifacator */
   string ident;
   /* File mime-type. */
   string mimeType;
   /* Page importance.
    * 0 – page is not important
    * 1 – page is important */
   int important;
   /* Page modification.
    * 0 – page is not modified
    * 1 – page attributes are modified
    * 2 – page data modified
    * 3 – page attributes and data modified */
   int modified;
   /* Page number */
   int pageNumber;
   /* Page notes or comments. */
   string note;
   /* Original filename. */
   string origName;
   /* Keys for page decryption/encryption. */
   string keys;
   /* Page signature. */
   string signature; 
  };
 };
};

Changed or new document is saved using method saveDocument. Save operation is done in three steps:

  1. Send new/changed document to the server. Server have to allocate new identifiers and send them to the client.

  2. Send binary data files

  3. Server have to send confirmation to the client about succesfull save opertaion.


Function for saving new document or new version:

SaveDocument saveDocument(string ticker, Document document);

Structure Document is parameter of the funcion. All requested items have to be correctly filled in the structure. Document identifier is empty string if document is saved for first time (new document). Server will return new document identifier.

Page identifiers are set only for existing unmodified pages. If page is modified or new identifier is empty string.

Function will return list of new file identifiers and identifier of new document. Server behavioure:

  1. If document is requested from the server when newer version is saved last saved version will be returned.

  2. If client is trying to save new version of the document in parallel with other client lock error have to be returned. Document is unlock on succesfull save operation, on error or on time-out.

Compatibility notice: error state 4 is valid only when STOREDOCUMENT is set to 1.

Notification about succefull save operation:

void receivedDocument(string ticker, string documentId, string documentVersion);

Function has no return value and is used only for client notification.

Methods for file transfer.

If file request (the section called “Request File”) failed other side should send response requestFileFailed. It is up to the caller to correctly display this error to the user.

void requestFileFailed(string ticker, string fileId, int errorCode, string description);

Parameter fileId is unique file identifier.

Parameter errorCode is error code.

Parameter description is error description.

Documents can be organized in the tree structure. There is API to manipulate with this tree ( create, change, remove folders, add items ,.. ).

Folders are quite similiar to folders on file system. Each folder has name (only root folder is empty string) and contains items. Item is document or another folder.

Methods allows to open folder. Client will receive for opened folder notifications about changes. Notifications are send until the folder is closed (the section called “Close Folder”).

Folder openFolder(string ticker, string folderId);

struct Folder { 
 // Status of folder 
 // -3 - no permission to open
 // -2 - folder is locked 
 // -1 - folder not exists 
 // 0 - ok
 int status;
 // Items in the folder 
 array items { 
  struct FolderItem { 
   // Type
   // 0 - folder, 1 - document
   int type;
   // Item id
   // id of folder or id of document
   string itemId;
   // Item name
   string name;
  };
 };
};