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

Check Identity
==============

The ``checkIdentity`` call provides a means to log-in into the service. You must make this call in
order to identify the user (obviously).

The response is a Hyperwave Object *User* as defined in :doc:`Data Structures </data_structures>`.

Additionllly, you will receive the following Cookies, which you must return to the server for each call
you are making from now on:


Request
-------

Request method is ``checkIdentity``:

::

  GET https://app.netfiles.de/;internal&action=json&apikey=<YourApiKey>&deviceID=<currentDeviceID>&method=checkIdentity
  Authorization: Basic BASE64(UTF8Bytes(<username>:<password>))
  Accept: application/json


Response
--------

The response is a json object (``application/json``) representing an HW_Object of type `User`.

E.g.:

.. code:: json

    {
        "response": {
            "id": "uid-imdat",
            "type": "person",
            "name": "imdat",
            "firstname": "Imdat",
            "lastname": "Solak",
            "realname": "Imdat Solak",
            "email": "imdat@solak.de",
            "href": "/users/imdat",
            "usercoll": {
                "type": "collection",
                "id": "ID-29855.6441339085936-1",
                "path": "/users/imdat",
                "documentClass": "user",
                "version": "",
                "downloadProhibited": false,
                "title": "Solak, Imdat",
                "name": "imdat",
                "creationDate": "2019/11/24 17:00:53 +0000",
                "modificationDate": "2020/03/09 12:45:57 +0000",
                "author": "System User",
                "writeAccess": true,
                "subDocs": "7"
            },
            "logintype": "sms",
            "lastSelectedProject": "",
            "projects": [
            ]
        }
    }



Returned Headers
----------------

+---------------------------+-----------------------------------+-------------------------------------------+
| Header                    | E.g.                              | Description                               | 
+===========================+===================================+===========================================+
| Date                      | Tue, 10 Mar 2020 08:56:00 GMT     | Date of call                              |
+---------------------------+-----------------------------------+-------------------------------------------+
| Server                    | netfiles                          | Name of the server                        |
+---------------------------+-----------------------------------+-------------------------------------------+
| Strict-Transport-Security | max-age=31536000                  | ??                                        |
+---------------------------+-----------------------------------+-------------------------------------------+
| Content-Disposition       | inline; filename="InitialRoot";.. | How is the content sent back              |
+---------------------------+-----------------------------------+-------------------------------------------+
| Content-Type              | application/json                  | Body type                                 |
+---------------------------+-----------------------------------+-------------------------------------------+
| Persistent-Auth           | true                              | ??                                        |
+---------------------------+-----------------------------------+-------------------------------------------+
| Cache-Control             | private                           | ??                                        |
+---------------------------+-----------------------------------+-------------------------------------------+
| Vary                      | Accept-Encoding                   | ??                                        |
+---------------------------+-----------------------------------+-------------------------------------------+
| Content-Encoding          | gzip                              | How is the body encoded                   |
+---------------------------+-----------------------------------+-------------------------------------------+
| Content-Length            | 849                               | Length of the body in bytes               |
+---------------------------+-----------------------------------+-------------------------------------------+
| Keep-Alive                | timeout=5, max=100                | HTTP-KeepAlive duration                   |
+---------------------------+-----------------------------------+-------------------------------------------+
| Set-Cookie                | s. below                          | Cookies to be set                         |
+---------------------------+-----------------------------------+-------------------------------------------+


Set Cookies
-----------
Following cookies are set:

+------------------+----------------+-----------------------------------------------------------------------+
| Cookie name      | Validity       | Description                                                           |
+==================+================+=======================================================================+
| netfiles         | Session only   | The Netfiles login cookie                                             |
+------------------+----------------+-----------------------------------------------------------------------+
| sk1              | 2 hr           | ??                                                                    |
+------------------+----------------+-----------------------------------------------------------------------+
| HW_User          | Session only   | The name of the Hyperwave user                                        |
+------------------+----------------+-----------------------------------------------------------------------+
| HyperwaveSession | 5 years        | Hpyerwave's internal session information                              |
+------------------+----------------+-----------------------------------------------------------------------+
| sk_s_web_S       | Session only   | ??                                                                    |
+------------------+----------------+-----------------------------------------------------------------------+
| sk_p_web_S       | 10 years       | ??                                                                    |
+------------------+----------------+-----------------------------------------------------------------------+

**You must return these cookies each time you make a call to the server except for the** ``checkIdentity`` **call**.

