.. Netfiles API documentation master file, created by
   sphinx-quickstart on Fri Mar  6 11:42:21 2020.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Get Content
==============

The ``getContent`` call applies only to objects of ``type`` ``document``. If you use this call on an object of ``type`` ``collection`` you will receive an error response.

Request
-------

Request method is ``getContent``:

::

  GET https://app.netfiles.de/<dataroom-name>/projectfiles/<parentname>/<objectname>;internal&action=json&apikey=<YourApiKey>&deviceID=<currentDeviceID>&method=getContent
  Authorization: Basic BASE64(UTF8Bytes(<username>:<password>))
  User-Agent: iPad
  netfiles: <value of the netfiles cookie>
  sk1: <value of the sk1 cookie>
  HW_User: <value of the HW_User cookie>
  HyperwaveSession: <value of the HyperwaveSession cookie>
  sk_s_web_S: <value of the sk_s_web_S cookie>
  sk_p_web_S: <value of the sk_p_web_S cookie>


Response Headers
----------------

**Note**: The response headers will tell you that the content is an ``application/json``, which is 
not correct. You have to check the result of a previous :doc:`Get Object <getobject>` call or the item
in the :doc:`Get Children <getchildren>` call of this objects parent.

What is important is that the ``content-length`` -header and the ``documentSize`` in the object record
should be identical.

Response
--------

The response is binary data of length ``content-length`` from the headers.

In order to process the received binary data correctly, you need to analyze the 
result of :doc:`Get Children <getchildren>` of the parent of this object (identify 
the right object there) or retrieve information about this object using the :doc:`Get Object <getobject>` call.

There you will find the actual document type in the ``documentType`` attribute.

You should also check the fingerprint of the received bytes against the ``md5Checksum`` from the record.


