User Ratings¶
Create or Update One Rating¶
-
PUT
users/<str:user_id>/ratings/<str:item_id>/
¶ Note
Authorized Roles: root, manager, backend, frontend
This endpoint allows you to create or update a rating for a user and an item. If the rating exists for the tuple
(user_id, item_id)
then it is updated, otherwise it is created. The taste profile of the user will be updated in real-time by the online machine learning algorithm.- Request JSON Object
rating (float32) – [min: 1 max: 10] Rating value
timestamp (float64) – Optional. [min: -150000000000.0 (year -2786) max: 3500000000.0 (year 2080)] Rating timestamp (default: now)
{ "rating": 8.5, "timestamp": 1588812345 }
Delete One Rating¶
-
DELETE
users/<str:user_id>/ratings/<str:item_id>/
¶ Note
Authorized Roles: root, manager, backend, frontend
Delete a single rating for a given user.
Errors:
NotFoundError with error name
USER_RATING_NOT_FOUND
if the user does not have a rating for this item
List All Ratings of One User¶
-
GET
users/<str:user_id>/ratings/
¶ Note
Authorized Roles: root, manager, backend
This endpoint allows you to list the ratings of one user. The response is paginated, you can control the response amount and offset using the query parameters
amt
andpage
.- Query Parameters
page (int) – Optional. [min: 1] Page to be listed.
amt (int) – Optional. [min: 1 max: 64] Amount of ratings to return
?page=1&amt=10
- Response JSON Object
warnings (list-of-string) – Optional. List of warnings
has_next (bool) – Indicates whether or not there are more pages to request
next_page (int) – Next page to request
user_ratings (object-array) –
Ratings array
Inner fields
item_id (ID) – [see Flexible Identifiers], [max_length: 64] Item ID
rating (float32) – [min: 1 max: 10] Rating value
timestamp (float64) – [min: -150000000000.0 (year -2786) max: 3500000000.0 (year 2080)] Rating timestamp
{ "has_next": false, "next_page": 2, "user_ratings": [ {"item_id": "123e4567-e89b-12d3-a456-426614174000", "rating": 8.5, "timestamp": 1588812345}, {"item_id": "c3391d83-553b-40e7-818e-fcf658ec397d", "rating": 2.0, "timestamp": 1588854321} ] }
Create or Update Many Ratings for One User in Bulk¶
-
PUT
users/<str:user_id>/ratings/
¶ Note
Authorized Roles: root, manager, backend, frontend
Create or update bulks of ratings for a single user and many items.
- Request JSON Object
ratings (object-array) –
Ratings array
Inner fields
item_id (ID) – [see Flexible Identifiers], [max_length: 64] Item ID
rating (float32) – [min: 1 max: 10] Rating value
timestamp (float64) – [min: -150000000000.0 (year -2786) max: 3500000000.0 (year 2080)] Rating timestamp
{ "ratings": [ {"item_id": "123e4567-e89b-12d3-a456-426614174000", "rating": 8.5, "timestamp": 1588812345}, {"item_id": "c3391d83-553b-40e7-818e-fcf658ec397d", "rating": 2.0, "timestamp": 1588854321} ] }
Delete All Ratings of Single User¶
-
DELETE
users/<str:user_id>/ratings/
¶ Note
Authorized Roles: root, manager, backend, frontend
Delete all ratings of a given user.
Create or Update Ratings for Many Users in Bulk¶
-
PUT
ratings-bulk/
¶ Note
Authorized Roles: root, manager, backend
Create or update large bulks of ratings for many users and many items.
- Request JSON Object
ratings (object-array) –
Ratings array
Inner fields
user_id (ID) – [see Flexible Identifiers], [max_length: 64] User ID
item_id (ID) – [see Flexible Identifiers], [max_length: 64] Item ID
rating (float32) – [min: 1 max: 10] Rating value
timestamp (float64) – [min: -150000000000.0 (year -2786) max: 3500000000.0 (year 2080)] Rating timestamp
{ "ratings": [ {"user_id": 1234, "item_id": "123e4567-e89b-12d3-a456-426614174000", "rating": 8.5, "timestamp": 1588812345}, {"user_id": 1234, "item_id": "c3391d83-553b-40e7-818e-fcf658ec397d", "rating": 2.0, "timestamp": 1588854321}, {"user_id": 333, "item_id": "c3391d83-553b-40e7-818e-fcf658ec397d", "rating": 5.5, "timestamp": 1588811111} ] }
List Ratings for All Users In Bulk¶
-
GET
ratings-bulk/
¶ Note
Authorized Roles: root, manager, backend
This endpoint allows you to list the ratings of one database. The response is paginated, you can control the response amount and offset using the query parameters
amt
andcursor
.- Query Parameters
amt (int) – Optional. [min: 1] Amount of ratings to return
cursor (string) – Optional. Pagination cursor, typically from the
next_cursor
value from the previous response
?amt=10&cursor=Q21vU1pHb1FjSEp...
- Response JSON Object
warnings (list-of-string) – Optional. List of warnings
ratings (object-array) –
Ratings array
Inner fields
user_id (ID) – [see Flexible Identifiers], [max_length: 64] User ID
item_id (ID) – [see Flexible Identifiers], [max_length: 64] Item ID
rating (float32) – [min: 1 max: 10] Rating value
timestamp (float64) – [min: -150000000000.0 (year -2786) max: 3500000000.0 (year 2080)] Rating timestamp
has_next (bool) – Indicates whether or not there are more ratings to request
next_cursor (string) – Pagination cursor to use in next request to get more ratings
{ "has_next": true, "next_cursor": "Q21vU1pHb1FjSEp...", "ratings": [ {"user_id": 1234, "item_id": "123e4567-e89b-12d3-a456-426614174000", "rating": 8.5, "timestamp": 1588812345}, {"user_id": 1234, "item_id": "c3391d83-553b-40e7-818e-fcf658ec397d", "rating": 2.0, "timestamp": 1588854321}, {"user_id": 333, "item_id": "c3391d83-553b-40e7-818e-fcf658ec397d", "rating": 5.5, "timestamp": 1588811111} ] }