Upload Dataset via API
Use this API endpoint to send batch data about items viewed together to an AddSearch index. This helps improve search recommendations based on user interactions.
API Endpoint
POST /v2/indices/{index_public_key}/recommendations-datasets/{dataset_name}/events:batch
index_public_key: Your AddSearch public site key, found in your dashboard.dataset_name: A descriptive name for the dataset, e.g.,shopping-cart.
Request Body
Send event data in the following JSON format:
{
"events": [
{ "transaction": "tx1", "item": "DKO-PROF1", "time": "2022-02-26" },
{ "transaction": "tx1", "item": "HEP-91331", "time": "2022-02-26" },
{ "transaction": "tx1", "item": "BCO-2208", "time": "2022-02-26" },
{ "transaction": "tx2", "item": "HEP-91331", "time": "2022-02-26" },
{ "transaction": "tx2", "item": "BCO-2208", "time": "2022-02-26" }
]
}
| Field | Description | Type | Notes |
|---|---|---|---|
| transaction | Unique identifier for the group of items | string | For example, a shopping cart ID where items were added |
| item | Item identifier | string | Example: product ID |
| time | Date and time of the event | string | ISO 8601 format, e.g., 2023-12-31 or 2023-12-31T12:30-02:00 |
Response
A successful request returns HTTP status code 200 OK with an empty body.
Notes
- Ensure your public key and dataset names are accurate.
- Send batch events grouped by transaction to represent items viewed or purchased together.
- The
timefield should follow ISO 8601 date-time format.
If you encounter errors, verify your authentication and payload formatting.