Skip to main content

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

    siteCode stringrequired

    Id of the Kameleoon project

    ean string

    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

    json boolean

    Set to true if you provide the body content in JSON format, else URL query format is assumed. See body schema

    Default value: 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:

NameTypeRequiredDescription
eanstringRequired if not provided in URL query parameters, else ignoredProduct code
eventTypestringRequiredOne of the following: PRODUCTPAGE, PRODUCTADDTOCART, PRODUCTBUY

List of parameters for the eventType PRODUCTPAGE:

NameTypeRequiredDescription
namestringOptionalProduct name
categoriesJSON arrayOptionalJSON array of product categories, see below for the product category type description
urlstringOptionalProduct URL
imageURLstringOptionalURL of product picture
availablebooleanOptionalIs product available?
availableQuantityint32OptionalAvailable quantities of product
brandstringOptionalProduct brand
isChildbooleanOptionalIs product is made for children?
isFashionbooleanOptionalDoes the product follow fashion?
fashionJSON objectOptionalSee below for the product fashion data type description
skustringOptionalProduct SKU
merchantIDstringOptionalProduct merchant Id
pricefloat64OptionalProduct price
oldPricefloat64OptionalProduct old (crossed-out) price
tagsJSON arrayOptionalJSON array of product tags (string)
ratingfloat64OptionalProduct rating
descriptionstringOptionalProduct description
paramsJSON arrayOptionalJSON array of product params, see below for the product param type description
groupIdstringOptionalProduct group id
accessoriesJSON arrayOptionalJSON array of product accessories (string)
seasonalityJSON arrayOptionalJSON array of monthes, from 1 to 12
priceMarginint32OptionalProduct price margin
isNewbooleanOptionalIs product is new?
autoJSON objectOptionalSee below for the product auto data type description
modelstringOptionalProduct model
leftoversstringOptionalProduct leftovers
typePrefixstringOptionalProduct type prefix

List of parameters for the eventType PRODUCTADDTOCART:

NameTypeRequiredDescription
quantityint32RequiredQuantity of product added to cart

List of parameters for the eventType PRODUCTBUY:

NameTypeRequiredDescription
quantityint32RequiredQuantity of product bought

The product category type is JSON object, with the following fields:

NameTypeRequiredDescription
idstringRequiredCategory Id
namestringOptionalCategory name
urlstringOptionalCategory URL
parentstringOptionalParent category id

The product fashion data type is JSON object, with the following fields:

NameTypeRequiredDescription
genderstringOptionalProduct gender
typestringOptionalProduct type
sizesJSON arrayOptionalJSON array of product sizes (string)
featurestringOptionalProduct feature
colorsJSON arrayOptionalJSON array of product colors, see below for the product color type description

The product color type is JSON object, with the following fields:

NameTypeRequiredDescription
colorstringRequiredColor
picturestringOptionalColor picture

The product param type is JSON object, with the following fields:

NameTypeRequiredDescription
namestringOptionalParam name
valueJSON arrayOptionalJSON array of param values (string)
unitstringOptionalParam unit

The product auto data type is JSON object, with the following fields:

NameTypeRequiredDescription
compatibilityJSON objectOptionalSee below for the auto compatibility data type description
vdsJSON arrayOptionalJSON array of auto VDS values (string)

The auto compatibility data type is JSON object, with the following fields:

NameTypeRequiredDescription
brandstringRequiredBrand
modelstringOptionalModel

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

URL query was processed successfully and no content is returned
Body will be processed asynchronously, no syntax check on body was done yet

Loading...