# Send ViewContent Event

#### <mark style="color:orange;">POST</mark>  ViewContent

```
https://api.naqrat.sa/api/viewcontent
```

#### ViewContent API

This API endpoint allows you to send a ViewContent event through the specified merchant when a customer views certain content within your site

**Request Body**

* `merchant` (Number): The ID of the merchant.
* `created_at` (String): The timestamp of the purchase creation.
* `cookiesocial` (Object): Contains social media tracking parameters.
  * `scid` (String): Social media campaign ID.
  * `fbp` (String): Facebook Pixel ID.
  * `fbc` (String): Facebook Click ID.
  * `ttclid` (String): Twitter Click ID.
  * `ttp` (String): TikTok Pixel ID.
  * `ga` (String): Google Analytics ID.
  * `twclid` (String): Twitter Click ID.
* `data` (Object): Contains customer, ecommerce, and page data.
  * `customer` (Object): Information about the customer.
    * `phone` (Number): Customer's phone number.
    * `email_hashed` (String): Hashed customer email.
    * `phone_hashed` (String): Hashed customer phone number.
    * `name` (String): Customer's name.
  * `products` (Array): Ecommerce event and purchase details.
    * `id` (Number): Product ID.
    * `category` (String): Product category.
    * `price` (String): Product price.
    * `quantity` (Number): Quantity of the product.
  * `currencyCode` (Object): Information about the page.
  * `event_id` (Number): Unique event ID.

**Response**

* `status` (String): Status of the purchase.
* `message` (String): Additional message related to the purchase.
* `products_count` (Number): Number of products in the purchase.
* `created_at` (String): Timestamp of the purchase response creation.

**AUTHORIZATION** <mark style="color:orange;">Bearer Token</mark>&#x20;

***

**Token**           `<token>`

**HEADERS**&#x20;

***

Accept          `application/json`

***

Body &#x20;

```json
{
    "merchant": 1539686597,
    "created_at":"2023-12-21 12:09:49",
    "cookiesocial":{
        "scid":"test pxil",
        "fbp":"facebook pxil",
        "fbc":"facebook pxil",
        "ttclid":"facebook pxil",
        "ttp":"facebook pxil",
        "ga":"facebook pxil",
        "twclid":"facebook pxil"
    },
    "data":{
        "customer":{
            "phone":201123036886,
            "email_hashed":"as@gmail.com (hash sha256)",
            "phone_hashed":"201123036886 (hash sha256)",
            "name":"Ahmed Saed",
         },
        "products":[
          {
              "id": 12789,
              "category": "فستان",
              "price": "127",
              "quantity": 4
          }
        ],
        "total_price": 127,
        "currencyCode": "SAR",
        "event_id": 662fa119
    }
}

```

**Example Request:**

```bash
curl --location 'https://api.naqrat.sa/api/viewcontent' \
--header 'Accept: application/json' \
--data-raw '{
    "merchant": 1539686597,
    "created_at":"2023-12-21 12:09:49",
    "cookiesocial":{
        "scid":"test pxil",
        "fbp":"facebook pxil",
        "fbc":"facebook pxil",
        "ttclid":"facebook pxil",
        "ttp":"facebook pxil",
        "ga":"facebook pxil",
        "twclid":"facebook pxil"
    },
    "data":{
        "customer":{
            "phone":201123036886,
            "email_hashed":"as@gmail.com (hash sha256)",
            "phone_hashed":"201123036886 (hash sha256)",
            "name":"Ahmed Saed",
         },
        "products":[
          {
              "id": 12789,
              "category": "فستان",
              "price": "127",
              "quantity": 4
          }
        ],
        "total_price": 127,
        "currencyCode": "SAR",
        "event_id": 662fa119
    }
}'
```

#### Response

***

Upon successful execution, the API will return a status 200 with the following response:

```json
{
    "data": {
        "status": "",
        "message": "",
        "products_count": 0,
        "created_at": ""
    }
}
```


---

# 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://developers.naqrat.sa/send-viewcontent-event.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.
