POST /product/events
POST/product/events
This endpoint can be used to post attributes (name, price etc.) and events (view, add to cart, purchase) for several products.
An incoming request is rejected if the source is identified as bot or spider, according to user-agent filtering rules from IAB/ABC. Kameleoon is using single-pass method. This means nothing specific is to be done in the case request is sent from a web browser using a standard library (XHR); but in other cases the user should set a custom value to the User-Agent request header, to overwrite the default value set by the library.
Request
Query Parameters
Id of the Kameleoon project
Product Id / EAN. Note: if EAN is provided here, then it is assumed as the common value for all events in the body (bulk posting of several events restricted to the same product EAN). On the contrary, if you would like to bulk post several events across several different products EAN, then you must provide the EAN with every event in the body
Set to true if you provide the body content in JSON format, else URL query format is assumed. See body schema
false
- */*
Body
required
Events to save. Body size limited to 8 MB.
When the URL query parameter is missing the "json" key or its value is set to false, the body consists of one or more lines, with each line representing an event in a specific format. The format is as follows: <parameter 1 name>=<parameter 1 value>&<parameter 2 name>=<parameter 2 value> and so on. Make sure to escape values that may contain characters = or &, for example using the function encodeURIComponent
in JavaScript.
If the URL contains the query parameter "json" with the value set to true, then the body will be a JSON array of events. Each event will be represented as a JSON object, formatted like this: {"<parameter 1 name>": <parameter 1 value>, "<parameter 2 name>": <parameter 2 value>, etc.}.
In all cases, the body will contain the following parameters:
Name | Type | Required | Description |
---|---|---|---|
ean | string | Required if not provided in URL query parameters, else ignored | Product code |
eventType | string | Required | One of the following: PRODUCTPAGE, PRODUCTADDTOCART, PRODUCTBUY |
List of parameters for the eventType PRODUCTPAGE:
Name | Type | Required | Description |
---|---|---|---|
name | string | Optional | Product name |
categories | JSON array | Optional | JSON array of product categories, see below for the product category type description |
url | string | Optional | Product URL |
imageURL | string | Optional | URL of product picture |
available | boolean | Optional | Is product available? |
availableQuantity | int32 | Optional | Available quantities of product |
brand | string | Optional | Product brand |
isChild | boolean | Optional | Is product is made for children? |
isFashion | boolean | Optional | Does the product follow fashion? |
fashion | JSON object | Optional | See below for the product fashion data type description |
sku | string | Optional | Product SKU |
merchantID | string | Optional | Product merchant Id |
price | float64 | Optional | Product price |
oldPrice | float64 | Optional | Product old (crossed-out) price |
tags | JSON array | Optional | JSON array of product tags (string) |
rating | float64 | Optional | Product rating |
description | string | Optional | Product description |
params | JSON array | Optional | JSON array of product params, see below for the product param type description |
groupId | string | Optional | Product group id |
accessories | JSON array | Optional | JSON array of product accessories (string) |
seasonality | JSON array | Optional | JSON array of monthes, from 1 to 12 |
priceMargin | int32 | Optional | Product price margin |
isNew | boolean | Optional | Is product is new? |
auto | JSON object | Optional | See below for the product auto data type description |
model | string | Optional | Product model |
leftovers | string | Optional | Product leftovers |
typePrefix | string | Optional | Product type prefix |
List of parameters for the eventType PRODUCTADDTOCART:
Name | Type | Required | Description |
---|---|---|---|
quantity | int32 | Required | Quantity of product added to cart |
List of parameters for the eventType PRODUCTBUY:
Name | Type | Required | Description |
---|---|---|---|
quantity | int32 | Required | Quantity of product bought |
The product category type is JSON object, with the following fields:
Name | Type | Required | Description |
---|---|---|---|
id | string | Required | Category Id |
name | string | Optional | Category name |
url | string | Optional | Category URL |
parent | string | Optional | Parent category id |
The product fashion data type is JSON object, with the following fields:
Name | Type | Required | Description |
---|---|---|---|
gender | string | Optional | Product gender |
type | string | Optional | Product type |
sizes | JSON array | Optional | JSON array of product sizes (string) |
feature | string | Optional | Product feature |
colors | JSON array | Optional | JSON array of product colors, see below for the product color type description |
The product color type is JSON object, with the following fields:
Name | Type | Required | Description |
---|---|---|---|
color | string | Required | Color |
picture | string | Optional | Color picture |
The product param type is JSON object, with the following fields:
Name | Type | Required | Description |
---|---|---|---|
name | string | Optional | Param name |
value | JSON array | Optional | JSON array of param values (string) |
unit | string | Optional | Param unit |
The product auto data type is JSON object, with the following fields:
Name | Type | Required | Description |
---|---|---|---|
compatibility | JSON object | Optional | See below for the auto compatibility data type description |
vds | JSON array | Optional | JSON array of auto VDS values (string) |
The auto compatibility data type is JSON object, with the following fields:
Name | Type | Required | Description |
---|---|---|---|
brand | string | Required | Brand |
model | string | Optional | Model |
Note: in the examples below, we assume the parameter "ean" is provided in the URL query part, so this is bulk posting of several events restricted to the same product, and then "ean" is not needed in body events.
Body example in the case the URL query parameter "json" is missing or present with value false (NB: %5B%22S%22%2C%20%22M%22%2C%20%22L%22%5D
is the escaped value of ["S", "M", "L"]
):
eventType=PRODUCTPAGE&name=Marvelous%20product&available=true&availableQuantity=50&sizes=%5B%22S%22%2C%20%22M%22%2C%20%22L%22%5D
eventType=PRODUCTADDTOCART&quantity=2
Body example in the case the URL query parameter "json" is present with value true, with a "pretty" representation (not recommended):
[
{
"eventType": "PRODUCTPAGE",
"name": "Marvelous product",
"available": true,
"availableQuantity": 50,
"isFashion": true,
"fashion": {
"sizes": [
"S",
"M",
"L"
]
}
},
{
"eventType": "PRODUCTADDTOCART",
"quantity": 2
}
]
Body example in the case the URL query parameter "json" is present with value true, with a "compact" representation (recommended):
[{"eventType":"PRODUCTPAGE","name":"Marvelous product","available":true,"availableQuantity":50,"isFashion":true,"fashion":{"sizes":["S","M","L"]}},{"eventType":"PRODUCTADDTOCART","quantity":2}]
string
Responses
- 204
- 400
- 401
- 403
- 413
- 429
- 500
URL query was processed successfully and no content is returned
Body will be processed asynchronously, no syntax check on body was done yet
Malformed URL query syntax
Failed authentication (missing token when required, or bad token: malformed, expired, or invalid signature)
Forbidden user-agent or access denied to restricted resource
Body too large
Rate limited
Unexpected internal error