Contents

/objects/(type)/(objectid)/(version)/files/(file)/content

The contents of a single file.

Methods

GET

Output: Stream: application/octet-stream
  Retrieves the object file contents.
Parameters: ?X-Hmac- Specifies the HMAC key
  ?mac - If true, appends a SHA-512 message authentication code at the end of the stream.

PUT

Note that PUT and DELETE verbs may not be supported in IIS; it is recommended to route them via the POST verb and specify the _method querystring parameter, as detailed in the compatibility page.

Input: Stream: application/octet-stream or multipart/form-data
Output: ObjectVersion
  Replaces the object file contents.

Supports Range header on GET:

Example

public string DownloadFile( int type, int id, int version, int fileid )
{
    // Construct the URL by filling type, id, version and file id.
    string url = string.Format(
        "http://example.org/REST/objects/{0}/{1}/{2}/files/{3}/content",
        type, id, version, fileid );

    // Create the web request.
    WebRequest request = WebRequest.Create( url );

    // Fill the authentication information.
    request.Headers["X-Authentication"] = this.AuthenticationToken;

    // Receive the response.
    var response = request.GetResponse();

    return new StreamReader( response.GetResponseStream() ).ReadToEnd();
}
Example 1: Downloading a file.