.. _api-request-headers:

API Request Headers 
-------------------

.. _21.3|VOSS-911|EKB-11874:
.. _21.3|VOSS-911|EKB-11871:


.. note::

   VOSS Automate will not support API Backward Compatibility from release 21.1
   and future releases. From release 21.1 forward, the following must be
   removed from API requests.

   * API parameter: ``api_version=<version_number>``
   * Request header: ``X-Version:<version_number>``

API Headers are available for pagination of choices and
macro results in an API call. 

The headers are ``X-range`` and ``Range``, with the starting value
as 0. These override and can be used instead of the ``skip`` and ``limit``
API parameters.

For example, the following examples return the same results:

::

   GET /api/tool/Macro/?method=evaluate
        &hierarchy=[hierarchy]
        &input={{fn.lines}}
        &skip=0
        &limit=6



   GET /api/tool/Macro/?method=evaluate
        &hierarchy=[hierarchy]
        &input={{fn.lines}}

        Request headers:

        X-Range: items=0-5
        Range: items=0-5

If the request is ``items=0-199`` (for 200 items) and there
are more results, the response will show:

::

   Content-Range:items 0-199/999999999

Since it is undetermined how many items there are, the 
value ``999999999`` represents the total.

In this example, we have a total of 298 items. if a subsequent
request is for the next 200 items (200-399), this includes the total.
The response will then also show the total number of items (298)
returned by the macro:

::

   Content-Range:items 200-399/298


Admin
.......................


All API requests for Automate Admin GUI to the Automate API include the following headers:

::

    REQUEST-PORTAL: Automate Admin
    PORTAL-TYPE: administration




Self-service
.............

All API requests for Self-service to the Automate API include the following headers:

::

   REQUEST-PORTAL: Automate Self-service
   PORTAL-TYPE: end-user

From a VOSS Automate API perspective, the headers are coming from Self-service.
However, from a browser perspective, the user will not see the headers in browser
developer tools, since Self-service requests are terminated by a Node.js server on the 
VOSS platform. The header injection is done in Node.js.


Microsoft Azure Web Proxy servers
....................................

All API requests for Microsoft Azure Web Proxy servers require the ``User-Agent`` header
(e.g. for ``AzureTestClient``):

::

   User-Agent: AzureTestClient

