Product events: a product ran out of stock, is on back order, its stock quantity changed, or it was deleted. Request parameters, notification selection and the response format are described in the [E-shop API overview](https://www.bulkgate.com/en/docs/eshop-api/eshop-api-overview/).

## API URL

| ENDPOINT                                                            | NOTIFICATION EVENT         |
|:--------------------------------------------------------------------|:---------------------------|
| `https://portal.bulkgate.com/api/1.0/eshop/product/out-of-stock`    | `product_out_of_stock`     |
| `https://portal.bulkgate.com/api/1.0/eshop/product/on-back-order`   | `product_on_back_order`    |
| `https://portal.bulkgate.com/api/1.0/eshop/product/update-quantity` | `product_update_quantity`  |
| `https://portal.bulkgate.com/api/1.0/eshop/product/delete`          | `product_delete`           |

> [!NOTE]
> If the request does not reach its destination, repeat it on the [backup server](https://www.bulkgate.com/en/docs/api-administration-tokens/api-backup-server/) `backup1.bulkgate.com`.

## Supported HTTP methods

- `POST` - `application/json`

```http
POST /api/1.0/eshop/product/out-of-stock HTTP/1.1
Host: portal.bulkgate.com
Content-Type: application/json
```

## Product variables

Pass the product data in `variables` using variables from the Product group, e.g. `product_id`, `product_name`, `product_quantity` or `product_sku`. The full list is in the [E-shop API overview](https://www.bulkgate.com/en/docs/eshop-api/eshop-api-overview/).

> [!TIP]
> The customer notification is sent only when `variables` contain the customer's phone number. Without it, only the admin notification is sent.

## Request example

```http-json
POST /api/1.0/eshop/product/out-of-stock HTTP/1.1
Host: portal.bulkgate.com
Content-Type: application/json

{
  "application_id": 451,
  "application_token": "NKN02TWE6NfBkfl-your-secret-token-Wf05GaqLIWLW4aBj",
  "variables": {
    "product_id": "318",
    "product_name": "BulkGate T-shirt, size M",
    "product_sku": "BG-TSHIRT-M",
    "product_quantity": "0"
  }
}
```

## Response

```json
{
    "data": {
        "admin": [
            {
                "status": "accepted",
                "message_id": "tmpde1bcd4b1d1",
                "part_id": ["tmpde1bcd4b1d1"],
                "number": "420777777777",
                "channel": "sms"
            }
        ]
    }
}
```

The meaning of the `customer` and `admin` keys, send errors and error types are described in the [E-shop API overview](https://www.bulkgate.com/en/docs/eshop-api/eshop-api-overview/).
