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)
EXAMPLE QUERY BODY¶{ "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
EXAMPLE QUERY PARAMS¶?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
EXAMPLE RESPONSE¶{ "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
EXAMPLE QUERY BODY¶{ "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
EXAMPLE QUERY BODY¶{ "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
EXAMPLE QUERY PARAMS¶?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
EXAMPLE RESPONSE¶{ "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} ] }
[Internal] List Number of Ratings by Users In Bulk¶
-
GET
ratings-bulk/count/
¶ Note
Authorized Roles: root, manager, backend
This endpoint allows you to list the number of ratings for each user of one database. The response is paginated, you can control the response amount and offset using the query parameters
amt
andcursor
.It is possible to filter users for counts greater than or equal to
min_count
, and counts less than or equal tomax_count
.- Query Parameters
amt (int) – Optional. [min: 1] Amount of users to return
cursor (string) – Optional. Pagination cursor, typically from the
next_cursor
value from the previous responsemin_count (int) – Optional. [min: 1] filter counts with values greater than or equal
max_count (int) – Optional. [min: 1] filter counts with values less than or equal
EXAMPLE QUERY PARAMS¶?amt=10&min_count=9&max_count=18&cursor=Q21vU1pHb1FjSEp...
- Response JSON Object
warnings (list-of-string) – Optional. List of warnings
users_counts (object-array) –
Users counts array
Inner fields
user_id (ID) – [see Flexible Identifiers], [max_length: 64] User ID
count (uint32) – number of ratings
has_next (bool) – Indicates whether or not there are more users to request
next_cursor (string) – Pagination cursor to use in next request to get more users
EXAMPLE RESPONSE¶{ "has_next": true, "next_cursor": "Q21vU1pHb1FjSEp...", "users_counts": [ {"user_id": 1111, "count": 9}, {"user_id": 2222, "count": 18}, {"user_id": 3333, "count": 10} ] }
Errors:
WrongData with error name
WRONG_DATA_TYPE
if there is a error with max_count and min_count values