# Example Usage of the HTTP API

{% hint style="info" %}
We highly recommend using JENTIS’ built-in functions to retrieve values instead of directly accessing cookies or localStorage data.\
This ensures forward compatibility in case JENTIS changes internal format structures.We highly recommend using our build functions to retrieve values and not directly access cookie or localStorage information in case JENTIS is changing format structures!
{% endhint %}

### Introduction

To use the HTTP API, three mandatory parameters are required:

* **JENTIS User ID**
  * **Why?** Gain access to the JENTIS User Storage.
* **JENTIS Session ID**
  * **Why?** Connect to the same Session.
* **Consent Information**
  * **Why?** You need to respect the consent decision of the user!

### Mandatory Data from the Website

#### JENTIS User ID

The **JENTIS User ID** is stored in the cookie jts-rw with the following example:

```
%7B%22u%22%3A%2280791172425362871393019%22%7D
```

After URL-decoding:

```
{"u":"80791172425362871393019"}
```

To access the value via JavaScript, use:

```
// '80791172425362871393019'
window.jentis.tracker.readDocumentID("user");
```

#### JENTIS Session ID

The **JENTIS Session ID** is stored in the cookie jctr\_sid with the following example:

```
40808176105057419630369
```

To access the value via JavaScript, use:

```
// '40808176105057419630369'
window.jentis.tracker.readDocumentID("session");
```

#### Consent Information

The **Consent Information** is stored in the localStorage key jentis.consent.data with a structure similar to:

```
{
  "value": {
    "consentid": "8808af84-f527-41e4-a806-c4138a40c040",
    "lastupdate": 1761050574194,
    "vendors": {
      "jentis_predictor_collector": true,
      "google_ads_id_pooling": true,
      "adobeanalytics": "ncm",
      "googleanalytics": false,
      "facebook": "ncm",
      "adwords": "ncm",
      "adtriba": false,
      "microsoftclarity": false,
      "bing": "ncm",
      "awin": false,
      "emarsys": false,
      "tiktok": false,
      "raw_data_pixel": "ncm",
      "jentis_diy_tracking_tool": "ncm",
      "criteo": false,
      "google_analytics_4_server-side": false,
      "pinterest_v5": false,
      "enhanced_raw_data": false,
      "floodlight": false,
      "cstm_stackadapt": false,
      "linkedin": false
    },
    "vendorsConsentMode": {
      "googleanalytics": 0,
      "facebook": 2,
      "adwords": 2,
      "adtriba": 0,
      "microsoftclarity": 0,
      "bing": 2,
      "awin": 0,
      "emarsys": 0,
      "tiktok": 0,
      "raw_data_pixel": 2,
      "adobeanalytics": 2,
      "jentis_diy_tracking_tool": 2,
      "linkedin": 0,
      "criteo": 0,
      "floodlight": 2,
      "google_analytics_4_server-side": 0,
      "cstm_stackadapt": 0,
      "pinterest_v5": 0,
      "enhanced_raw_data": 0,
      "jentis_predictor_collector": 1,
      "cstm_pagentai": 0
    },
    "send": true,
    "userconsent": true,
    "data": {}
  },
  "ttl": 33696000000,
  "expiry": 1794746574194
}
```

Required Data from the above structure, we only need the vendors property:

```
{
      "jentis_predictor_collector": true,
      "google_ads_id_pooling": true,
      "adobeanalytics": "ncm",
      "googleanalytics": false,
      "facebook": "ncm",
      "adwords": "ncm",
      "adtriba": false,
      "microsoftclarity": false,
      "bing": "ncm",
      "awin": false,
      "emarsys": false,
      "tiktok": false,
      "raw_data_pixel": "ncm",
      "jentis_diy_tracking_tool": "ncm",
      "criteo": false,
      "google_analytics_4_server-side": false,
      "pinterest_v5": false,
      "enhanced_raw_data": false,
      "floodlight": false,
      "cstm_stackadapt": false,
      "linkedin": false
}
```

To access the vendor consent information safely, use the built-in JENTIS method:

```
// Returns a complete JSON object of all vendor consents
window.jentis.consent.engine.getAllConsents();
```

### Example Request

```
{
  "version": "3",
  "system": {
    "type": "http-api",
    "timestamp": 1771593267561,
    "navigator-userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36",
    "initiator": "jts_push_submit",
    "href": "https://www.test.co/orderconfirmationpage"
  },
  "consent": {
    "google_analytics_4_server-side": {
      "status": true,
      "execute": true
    }
  },
  "configuration": {
    "container": "testco",
    "environment": "live",
    "version" : "6", // Optional for Debugging in a preview
    "debugcode" : "asdklfjasldkfj-Asdf-asdfasdf" // Optional for Debugging in a preview
  },
  "data": {
    "identifier": {
      "user": {
        "id": "32683174066021788113700",
        "action": "update"
      },
      "session": {
        "id": "45334174066021790071705",
        "action": "update"
      }
    },
    "variables": {
      "jtspushedcommands": ["api-order-mobile-pay", "submit"],
      "document_title": "Order Confirmation",
      "document_location_href": "https://www.test.co/",
      "order_brutto": "250.00",
      "order_id": "ORDERID",
      "order_netto": "123.12",
      "order_shipping": "",
      "order_tax": "",
      "product_affiliation": ["", ""],
      "product_artbox_motiv_id": ["", ""],
      "product_artbox_sku": ["", ""],
      "product_brand": ["Milka", "Milka"],
      "product_brutto_price_total": [5.7, 371.7],
      "product_brutto_price_with_default": [1.9, 123.9],
      "product_category": [
        ["Small Sortiment", "Baby"],
        ["Small Sortiment", "Baby"]
      ],
      "product_category_1st": ["Small Sortiment", "Small Sortiment"],
      "product_category_2nd": ["Baby", "Baby"],
      "product_category_3rd": ["", ""],
      "product_category_4th": ["", ""],
      "product_category_5th": ["", ""],
      "product_coupon": ["", ""],
      "product_discount_raw": ["", ""],
      "product_discount_with_default": ["-0.90", "26.10"],
      "product_id": ["1111", "2222222"],
      "product_id_with_default": ["1111", "2222222"],
      "product_location_id": ["", ""],
      "product_name": ["X1", "Baby Oil"],
      "product_name_with_default": ["X1", "Baby Oil"],
      "product_position": [1, 2],
      "product_price": [1.9, 123.9],
      "product_quantity": [3, 3],
      "product_quantity_with_default": [3, 3],
      "product_type": ["order", "order"],
      "product_variant": ["", ""]
    }
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.jentis.com/http-api-tracking/example-usage-of-the-http-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
