is there any way to use API in order to get the unwatched/watched movie numbers of non owner user?
I have an app that creates a cache file of unwatched movies but it only works for the owner.
I tried some combinations of API calls but I only get wrong data back.
As an alternative, would be to get a copy of the database, since we do NOT access the live database from 3rd. Party tools, and then query the copy of that database with SQL
You as the server admin can retrieve each user’s server access token - no login to their account required. The server token is used to access your own server.
This is not the same as the account token you get by logging in to their account with their username/password. The account token grants access to the account on plex.tv.
For the admin, both tokens are the same (access to plex.tv and your own server).
from plexapi.server import PlexServer
PLEX_URL = "http://localhost:32400"
ADMIN_TOKEN = "XXXXXXXXXXXXXXXXXXXX"
# Admin Plex server instance.
plex_admin = PlexServer(PLEX_URL, ADMIN_TOKEN)
# Unwatched movies by the admin.
movies = plex_admin.library.section("Movies").search(unwatched=True)
# Switch to "Username2" on your own server. This does the magic behind the scenes to automatically retrieve the user's server token.
# Returns a user Plex server instance.
plex_user = plex_admin.switchUser("Username2")
# Unwatched movies by "Username2"
movies = plex_user.library.section("Movies").search(unwatched=True)
Not native English here, but when you call a PMS endpoint with a different token, that in my book is a sign-in/login as a different user on the PMS, not plex.tv
When said, I do agree with everything else you said!