recombee_api_client.api_requests.add_purchase module

class recombee_api_client.api_requests.add_purchase.AddPurchase(user_id, item_id, timestamp=UUID('45014abe-5a03-4ea1-ba2e-32b075af0294'), cascade_create=UUID('45014abe-5a03-4ea1-ba2e-32b075af0294'), amount=UUID('45014abe-5a03-4ea1-ba2e-32b075af0294'), price=UUID('45014abe-5a03-4ea1-ba2e-32b075af0294'), profit=UUID('45014abe-5a03-4ea1-ba2e-32b075af0294'), recomm_id=UUID('45014abe-5a03-4ea1-ba2e-32b075af0294'), additional_data=UUID('45014abe-5a03-4ea1-ba2e-32b075af0294'))

Bases: recombee_api_client.api_requests.request.Request

Adds a purchase of a given item made by a given user.

Required parameters:

  • user_id – User who purchased the item

  • item_id – Purchased item

Optional parameters:

  • timestamp – UTC timestamp of the purchase as ISO8601-1 pattern or UTC epoch time. The default value is the current time.

  • cascade_create – Sets whether the given user/item should be created if not present in the database.

  • amount – Amount (number) of purchased items. The default is 1. For example if user-x purchases two item-y during a single order (session…), the amount should equal to 2.

  • price – Price paid by the user for the item. If amount is greater than 1, sum of prices of all the items should be given.

  • profit – Your profit from the purchased item. The profit is natural in e-commerce domain (for example if user-x purchases item-y for $100 and the gross margin is 30 %, then the profit is $30), but is applicable also in other domains (for example at a news company it may be income from displayed advertisement on article page). If amount is greater than 1, sum of profit of all the items should be given.

  • recomm_id – If this purchase is based on a recommendation request, recommId is the id of the clicked recommendation.

  • additional_data – A dictionary of additional data for the interaction.


Values of body parameters as a dictionary (name of parameter: value of the parameter).


Values of query parameters as a dictionary (name of parameter: value of the parameter).