This API is used to bulk-ingest user activity history (favorites-list/watchlist, view details, ratings etc.) of a user. Multiple assets’ activity can be ingested at a time.
It accepts a JSON object with the following fields:
favorites: This optional field is an array of guids of the assets that the user has added to his favorites.
view_data: This optional field is an array of objects with each object containing user’s viewing data for one asset. The following fields are added in each asset-object:
asset_id: This mandatory field stores the guid of the asset with which this object’s data is associated.
play_count: This optional integer indicates how many times user has played this asset.
view_time: This optional integer stores the number of seconds that the user has watched this asset.
pause_time: This optional integer stores the player position(in seconds) at the time the user stopped.This is the “Continue Watching” features.
last_played_on: This optional field contains the unix timestamp (in milliseconds) of when user last started playback of this asset.
user_rating: This optional scale contains the user rating for this asset on a scale of 0-5.
Using isDelta query parameter, you can choose to ingest/overwrite the entire activity history of users’ activity (isDelta=false) or only include additions to users’ activity records (isDelta=true). Some sample use cases are listed below:
If you want to overwrite all user’s activity history, set isDelta to false and send the new data in it.
If you want to update a user’s activity record, set isDelta to true and send an object with only user_id and corresponding changes. For example, to update favorites list, set isDelta=true and send new favorites field with new list. If you send a favorites value with an empty array, the favorites will be erased. If you do not send a favorites field at all, then the existing favorites are retained.
If you want to add/update a user’s rating to an asset_id XYZ, set isDelta to true and send an object with view_data containing an object with asset_id XYZ with new user_rating. In case you are updating the rating to a new value, if you do not specify new values for other fields like view_time, play_count, their old values will be retained.
Resource URL
PUT - /metax/3.0/ui/user/stat/{SUBSCRIBER_ID}
Header Paramater
Authorization
required
Bearer Access Token to be sent with all client requests.
Content-Type
required
application/json
URL Parameter
isDelta
optional
Values can be true/false. Default value is 'true'.
true - Additional information.
false - Lifetime history. i.e. all the old user activity information will be overridden by the new information.
Example Request URL
PUT - http://__JTV__HOST__/metax/3.0/ui/user/stat/user@example.org