Contextualize REST API: Preview category context

Method description

As discussed in the endpoint to obtain the category scores of the category products, the results depend on the users' navigation events and the weights given by the client for the fields within each category.
In order to have a vision of the changes that cause the changes in the weights of the fields (equalize) within a category, can obtain a fast preview of the results with this endpoint.

These results will be obtained by sending a customized equalize and calculating these scores taking into account only some days of navigation events data within a category.

HTTP method

GET

URL schema

/v2/categorycontext/{client_id}/preview?categoryId={categoryId}&categoryEqualize={customEqualize}&categoryEqualizeEvents={customEqualizeEvents}

URL example

/v2/categorycontext/ebdemo/preview?categoryId=125151632&categoryEqualize={"price":5,"stock":4,"color":1}&categoryEqualizeEvents={"browseProduct":1,"browseCheckout":3}

Path Parameters

Parameter nameRequiredDescription
client_id(tick)Client identifier on the system

URI Parameters

Parameter nameRequiredDescriptionDefaultMax Example
categoryEqualize(tick)Custom equalize to obtain products scores related to.--categoryEqualize={"price":5,"stock":4,"color":1}
categoryEqualizeEvents(tick)Events weights to affect scores.--categoryEqualizeEvents={"browseProduct":1,"browseCheckout":3}
categoryId(tick)CategoryId to get the product scores.--categoryId=125151632
lang(error)Language of the category to request.There is a default lang in service configuration.-lang=en
field(error)Field name to get value from the products in the preview.{"eb_name", "eb_image"}-field=tittle&field=image_url...
maxProducts(error)Maximum of products in the output result.50100maxProducts=100

Responses

200 - successful request

Type: application/json

Example application/json
[
  {
      "pid": "656296",
      "eb_name": "Product 1",
      "eb_image": "../assets/product1.jpg",
      "scores": {
            "price": 0.3055021834061135,
            "stock": 0.054012821703985886,
            "color": 0.20550218340611354,
			"events" 0.1100000001
      },
      "events": {
      		"browseCheckout": 0,
      		"browseProduct": 10,
      		"browseAdd2Cart": 3
    },
      "score": 0.675017188516213
  },
  {
      "pid": "2352351",
      "eb_name": "Product 2",
      "eb_image": "../assets/product2.jpg",
      "scores": {
            "price": 0.30078602620087336,
            "stock": 0.062488153860447836,
            "color": 0.20078602620087338,
			"events" 0.1100000001
      },
      "events": {
      		"browseCheckout": 0,
      		"browseProduct": 10,
      		"browseAdd2Cart": 3
      },
      "score": 0.675017188616213
  },
  {
      "pid": "7515814",
      "eb_name": "Product 3",
      "eb_image": "../assets/product3.jpg",
      "scores": {
            "price": 0.3005240174672489,
            "stock": 0.02924742172256806,
            "color": 0.20052401746724893,
			"events" 0.1100000001
      },
      "events": {
      		"browseCheckout": 0,
      		"browseProduct": 10,
      		"browseAdd2Cart": 3
      },
      "score": 0.675017188616213
  },
  ...
]
400 - mandatory query parameter is missing

Type: application/json

Example application/json
{
  "code": 400,
  "error": "categoryId is mandatory"
}
404 - either client or endpoint don't exist

Type: application/json

Example application/json
{
  "code": 404,
  "error": "XXX not found"
}