.. 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 PDF
===============

The ``getContentPDF`` 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 ``getContentPDF``:

::

  GET https://app.netfiles.de/<dataroom-name>/projectfiles/<parentname>/<objectname>;internal&action=json&apikey=<YourApiKey>&deviceID=<currentDeviceID>&method=getContentPDF
  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 will need to check the binary data to see if you received a PDF or the ``documentType`` from
the result of a previous :doc:`Get Object <getobject>` call or the item
in the :doc:`Get Children <getchildren>` call of this objects parent.

Response
--------

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

The actual content-type depends on whether the document's content could be converted to PDF or not on the server.
If the content could be converted to PDF, you will receive a PDF content. Otherwise you will receive the original, raw
content data.

You will need to check yourself what type you are receiving.

If you receive original raw content, 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.

*Note: If you receive the content as PDF you cannot check the original file's md5 checksum against the md5 checksum of retrieved
content.*

