Abstract
Specify messaging protocol for remote file system reading and writing (files metadata and content).
Messaging
Client and server exchange messages in XML format using request-response paradigm. Generic request format is:
[request body]
</request>
Where:
- N — sequence number (generated by client, must be unique in a session scope)
- T — request type (operation specific, such as "list", "remove" etc.)
- request body — request type specific XML content
Server respond with XML formatted response message, generic response format is:
<response id="N" type="T"> [response body] </response>Where:
- N — sequence number, must match request ID
- T — response type, must be one of
- ok — request has been processed normally and response body contains processing result
- error — request processing terminated unexpectedly, response body contains error message and code (client typically display on user GUI):
<message>Error message</message>
<code>Error code</code>
Error message is a human readable string. Error code is a alphanumeric value, see "Error codes" section for known values. - response body — request/response type specific XML content
Common
Any date/time information used in XML should be formatted using following pattern:
yyMMddHHmmssZ, for example, 010704120856-0700.
Protocol operates on files, below is a common structure definition for a file object:
<file>
<type>${type}</type>
<path>${path}</path>
<name>${name}</name>
<length>${length}</length>
<created>${created}</created>
<modified>${modified}</modified>
</file>
Where:
- Type — file type, one of:
- "f" — file
- "d" — directory
- Path — a full path to the file, for example: "/dir/document.txt"
- Name — a name of the file (title and extension), for example: "document.txt"
- Length — file length (bytes), valid for files only (not directories)
- Created — file created timestamp
- Modified — file last modified timestamp
A "file" element may contain nested "file" elements, this reflects file hierarchy.
There is a special character "/" (slash) used to separate files in the path (file separator).
There is a special root file, which is ancestor for all other files. The root file name matches its path and equal to the file separator ("/"). The root file type is directory, root file is immutable and have no created and modified timestamps.
All the file names and paths are case sensitive.
Protocol
Request type and description |
Request example |
Response example |
get |
<request id="1" type="get"> |
<response id="1" type="ok"> |
list |
<request id="1" type="list"> |
<response id="1" type="ok"> |
mkdir |
<request id="1" type="mkdir"> |
<response id="1" type="ok"> |
delete |
<request id="1" type="delete"> |
<response id="1" type="ok"> |
move |
<request id="1" type="move"> |
<response id="1" type="ok"> |
upload |
<request id="1" type="upload"> |
<response id="1" type="ok"> |
download
The data transfer process is implementation specific. |
<request id="1" type="download"> |
<response id="1" type="ok"> |
Error codes
This section contains well known error codes for exceptional responses.
| Code | Description |
fileSystem.generalFailure |
File system general failure. |
fileSystem.fileNotFound |
File not found. This is usually thrown by an operation that requires file existence, for example "get" or "download". |
fileSystem.fileExists |
File exists. This is usually thrown by an operation that assume target file absence, for example "mkdir" or "move". |
| fileSystem.unauthorized | Authoriaztion required |
HTTP transport
This section describes HTTP implementation details. All the requests issued by client should be POSTed to predefined HTTP URL. XML request content should be set in parameter named "request". Server should respond with HTTP OK (200) result code (even if response type is "error"), response content type should be "text/xml" and response content should be XML document.
Upload
If upload request accepted, server must send upload URL:
<response id="1" type="ok">
<url>http://host/uploadLink</url>
</response>
Client will issue POST request and send file content as request raw data.
Download
If download request accepted, server must send download URL:
<response id="1" type="ok">
<url>http://host/downloadLink</url>
</response>
Client will issue GET request and treat response content as file data.
