Jump to content

Setting item's user_data attributes


iloveparks
Go to solution Solved by Luke,

Recommended Posts

iloveparks

Hello all,

I'm struggling to update/understand the user_data attribute associated with an item.

I'm confused on two fronts.. It would be nice if I could update the user_data associated with each item via the ItemUpdate endpoint, but my changes do not seem to stick.  I am grabbing the entire item via UserLibraryServiceApi/Users/{UserId}/Items/{Id}, making my adjustments - setting favorite and rating in the item.user_data attribute and then POSTing via ItemUpdateServiceApi/Items/{ItemId}.  Other changes that I make to this item outside of the item.user_data attribute do seem to stick (such as audience/critic rating/content rating.)

Further research shows there are a few different endpoints to deal with user_data - such as setting the item as a favorite and setting a custom rating.  Setting/removing as a favorite works fine via UserLibraryServiceApi/Users/{UserId}/FavoriteItems/{Id}. (Still confused as to why it does not work via ItemUpdateServiceApi/Items/{ItemId}.)

However, UserLibraryServiceApi/Users/{UserId}/Items/{Id}/Rating only seems to accept a boolean value of "Likes" - I would think this endpoint grants the ability to set user_data.rating, which should be a number.

The UserItemDataDTO schema shows the following:

UserItemDataDto{
Rating	number($double, nullable)
PlayedPercentage	number($double, nullable)
UnplayedItemCount	integer($int32, nullable)
PlaybackPositionTicks	integer($int64)
PlayCount	integer($int32)
IsFavorite	boolean
LastPlayedDate	string($date-time, nullable)
Played	boolean
Key	string
ItemId	string
}

 

Any help is appreciated, thank you!

Link to comment
Share on other sites

  • 3 weeks later...
  • Solution

Hi, there is actually an api to update the whole object:

/Users/{UserId}/Items/{ItemId}/UserData

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...