So I’m aware of /status/sessions/history/all, but there have been two issues for me.
First, I want to know if an item has been completely played or not. When I play an item and stop half through, the item appears on that list, while I only want to get the items that have been completely watched. Is this possible to retrieve via the Plex API?
Second, I noticed that the endpoint is restricted to admin users only. Is it possible to give normal users access? Or is there another endpoint that returns similar data (watch history) for normal users?
1 - Not with that api. That api only tracks when something is played, not how much. Alternatively you could call up the library and filter for unwatched=0, which will return all watched items for that library. You’d have to make this request for each library.
2 - Normal users don’t have access to the history, that is admin only. The alternative above will work with other users.
The alternative above will include items that were “marked as watched” too. I’m not aware of an endpoint that will give a list of things actually watched. If that’s what you want, I guess you could use the history and cross reference with this alternative list.
Thank you for your answer.
I don’t see an unwatched attribute though at the endpoint /library/sections/<sectionnumber>/all.
I only see viewCount, but that one also counts the items that have not been completely watched.
Additionally, I can’t access the endpoint with an API key from a normal user. Or is it restricted to household only? Because I’m testing with another account.
At which endpoint can I find the unwatched filter?
http://127.0.0.1:32400/library/sections/2/all?unmatched=0&X-Plex-Token=…
Replace the section ID and add your token.
This should work for other users too, just include their token.
Thank you for your help!
Is it possible to get multiple watched records for one item, and not only the most recent time?
For example, if I watch the same movie three times on three separate occasions, can I see those three separate times?
I tried this, and the endpoint only provides the most recent timestamp that the item has been watched.
No. The endpoint I referred to does not know the history of an item. You would need the history endpoint for that. There isn’t a single endpoint that will give you what you want.
Just as a side note… I recently wanted to start looking at user play history, but for everyone. Or more specifically, what show/movies that no one has watched. I know there are some tools out there, but non seemed that great and some were quite slow.
I ended up making sure my PMS backups went to a network share and from there I’ve been able to access the latest DB file. It’s taking some messing around, but I’ve started to find the tables and links between tables.
So for me, if you want to know the history of watched and unwatched files, for all users on your PMS, it might be worth working through the DB? 