User Interactions

Create One Interaction

POST users/<str:user_id>/interactions/<str:item_id>/

Note

Authorized Roles: root, manager, backend, frontend

This endpoint allows you to create a new interaction for a user and an item. An inferred rating will be created or updated for the tuple (user_id, item_id). The taste profile of the user will then be updated in real-time by the online machine learning algorithm.

Request JSON Object
  • interaction_type (string) – [max-length: 64] Interaction type

  • timestamp (float64) – Optional. Interaction timestamp (default: now)

EXAMPLE QUERY BODY
  {
      "interaction_type": "productView",
      "timestamp": 1588812345
  }

Errors:

  • ServerUnavailable with error name DB_IMPLICIT_TO_EXPLICIT_PARAMS_NOT_FOUND if no “implicit-to-explicit” parameters have been set for this database

Create Interactions for Many Users in Bulk

POST interactions-bulk/

Note

Authorized Roles: root, manager, backend

Create or update large bulks of interactions for many users and many items. Inferred ratings will be created or updated for all tuples (user_id, item_id).

Request JSON Object
  • interactions (object-array) –

    Interactions array

    Inner fields:

    • user_id (ID) – [see Flexible Identifiers] User ID

    • item_id (ID) – [see Flexible Identifiers] Item ID

    • interaction_type (O) – [max-len:64chars] Interaction type

    • timestamp (float64) – Interaction timestamp

EXAMPLE QUERY BODY
  {
      "interactions": [
          {"user_id": 1234, "item_id": "123e4567-e89b-12d3-a456-426614174000", "interaction_type": "productView", "timestamp": 1588812345},
          {"user_id": 1234, "item_id": "c3391d83-553b-40e7-818e-fcf658ec397d", "interaction_type": "productView", "timestamp": 1588854321},
          {"user_id": 333, "item_id": "c3391d83-553b-40e7-818e-fcf658ec397d", "interaction_type": "addToCart", "timestamp": 1588811111},
      ]
  }

Errors:

  • ServerUnavailable with error name DB_IMPLICIT_TO_EXPLICIT_PARAMS_NOT_FOUND if no “implicit-to-explicit” parameters have been set for this database