Tagging REST API: Track a batch of events

Overview

Endpoint to register a batch of events at the same time. The events that can be registered are the same that can be registered individually with its own endpoint

Endpoint Name

batch

Service URL (POST)

URL_TAGGING/INSTANCE_ID/{sinkId}/batch

The event data is sent as the body of a POST request, in JSON format

Where:

  • sinkId is one of the following:

    • query

    • click

    • wishlist

    • checkout

Input data

The input data is sent in JSON format as the body of a POST request. The input data format is the following:

[ { "date": 1610352661069, //optional "ip": "1.1.1.1" // optional "eventData": { [...] } }, { "date": 1610352661069, //optional "ip": "1.1.1.1" // optional "eventData": { [...] } }, ]

The eventData depends on the type of event (sinkId) that is being tracked. Please refer to the trackQuery, trackClick, trackWishlist or trackCheckout  parameters depending on the type of event to check what fields eventData should contain.

For example, the body of a request for tracking 2 queries can be:

[ { "eventData": { "lang": "gl_ES", "catalog": "default", "scope": "mobileweb", "section":"WOMAN", "store": "11719", "q":"tenis", "totalHits": "1", "origin": "empathize_term", "type": "4", "page": "3", "session": "dc9cc26d-ee5a-44bb-97de-ea50d2c4ef23", "user": "36bf0440-e4e6-46e9-9b2a80b74f6cd933", "externalBoosted": "false", "contextualizeEnabled": "false", "spellcheck": "false", "title": "tenis" } }, { "eventData": { "lang": "gl_ES", "catalog": "default", "scope": "mobileweb", "section":"WOMAN", "store": "11719", "q": "shoes", "page": "5", "totalHits": "1", "origin": "empathize_term", "type": "4", "session": "dc9cc26d-ee5a-44bb-97de-ea50d2c4ef23", "user": "36bf0440-e4e6-46e9-9b2a80b74f6cd933", "externalBoosted": "false", "fieldMatch": "default", "filtered": "true", "contextualizeEnabled": "false", "spellcheck": "false", "title": "zapatos" } } ]

Output

This endpoint returns:

200: Ok and empty body if every event is has a successful track

The worst (higher) http code response of single events if some event fails. In this case, the body contains the individual response code and a optional message for each event (keeping the order on the input object):

[ {"code": 200}, {"code": 400,"error": "com.eb.tagging.util.exception.SerializationException: Field [q] is mandatory and cannot be null or empty"} ]