2024-01-03, 07:01 PM
(This post was last modified: 2024-01-20, 04:55 PM by hieroglyph. Edited 1 time in total.)
Unable to POST an UserData update - Getting 404 Not Found - HTTPError
What Is Happening:
When POSTing an update to a user's UserData for a media item (e.g. movie or episode) the error code response is 404 Not Found - HTTPError.
What I Am Expecting To Happen:
When POSTing an update to a user's UserData for a media item (e.g. movie or episode), I am expecting the media item to be updated and to receive a 204 response.
Python debug can be found here: python_Debug_20240103121000.log
To help correlate the Python debug with the Jellyfin debug...
The time the script was started and the time the script exited due to the 404 Not Found HTTPError:
The URL, Method, Header, and Data used in the POST to the Jellyfin server:
The x4 attempts to POST the UserData update along with timestamps:
Jellyfin debug can be found here: jellyfin_Debug_20240103121000.log
Other relevant information; there may be a different/better way to do this:
When importing played states from Trakt, the PlayCount=1 and Played=true. However, the LastPlayedDate field is missing.
I am using a script to delete media after certain conditions are met. The script needs to know when the media item was last played for a given user. To account for this; when a media item imported from Trakt is found that does not have LastPlayedDate, the current date-time is used. The script then uses this date-time to determine when the media item should be deleted.
Also tried toggling the Played field (True --> False --> True) to get Jellyfin to populate the date-time. But get the same 404 Not Found - HTTPError.
- Jellyfin Version: 10.8.13
- Python Version: 3.10.12
- Debian 12 LXC via Proxmox (OS Info: Linux-5.15.0-91-generic-x86_64-with-glibc2.35); installed using "curl https://repo.jellyfin.org/install-debuntu.sh | sudo bash"
What Is Happening:
When POSTing an update to a user's UserData for a media item (e.g. movie or episode) the error code response is 404 Not Found - HTTPError.
What I Am Expecting To Happen:
When POSTing an update to a user's UserData for a media item (e.g. movie or episode), I am expecting the media item to be updated and to receive a 204 response.
Python debug can be found here: python_Debug_20240103121000.log
To help correlate the Python debug with the Jellyfin debug...
The time the script was started and the time the script exited due to the 404 Not Found HTTPError:
Code:
Time Stamp Start: 20240103121002
Code:
Script Stopped: 2024-01-03 12:10:19.200060
The URL, Method, Header, and Data used in the POST to the Jellyfin server:
Code:
HTTPError: Unable to get information from server during processing of: add_missing_LastPlayedDate
Object: <bound method Request.header_items of <urllib.request.Request object at 0x7f753bdc1930>>
URL: http://172.31.14.151:8096/Users/b67067630d2b47838ebbd53262f5d335/Items/c0ccd8124cf75279fb26ddc5801c0982/UserData?api_key=608145c83a7f4b50a9a59b721da61da0
Method: POST
Header: {'Content-type': 'application/json'}
Data: b'{\n "PlaybackPositionTicks": 0,\n "PlayCount": 0,\n "IsFavorite": false,\n "Played": false,\n "Key": "528085",\n "LastPlayedDate": "2024-01-03T12:10:02.000Z"\n}'
HTTPError: 404 - Not Found
The x4 attempts to POST the UserData update along with timestamps:
Code:
2024-01-03 12:10:03.997290 - add_missing_LastPlayedDate
2024-01-03 12:10:05.009565 - add_missing_LastPlayedDate
2024-01-03 12:10:07.019804 - add_missing_LastPlayedDate
2024-01-03 12:10:11.032644 - add_missing_LastPlayedDate
Jellyfin debug can be found here: jellyfin_Debug_20240103121000.log
Other relevant information; there may be a different/better way to do this:
When importing played states from Trakt, the PlayCount=1 and Played=true. However, the LastPlayedDate field is missing.
Code:
['UserData'] from server before POSTing update:
{
"PlaybackPositionTicks": 0,
"PlayCount": 1,
"IsFavorite": false,
"Played": true,
"Key": "528085"
}
I am using a script to delete media after certain conditions are met. The script needs to know when the media item was last played for a given user. To account for this; when a media item imported from Trakt is found that does not have LastPlayedDate, the current date-time is used. The script then uses this date-time to determine when the media item should be deleted.
Code:
Expected ['UserData'] from server after POSTing update:
{
"PlaybackPositionTicks": 0,
"PlayCount": 1,
"IsFavorite": false,
"Played": true,
"Key": "528085",
"LastPlayedDate": "2024-01-03T12:10:03.000Z"
}
Also tried toggling the Played field (True --> False --> True) to get Jellyfin to populate the date-time. But get the same 404 Not Found - HTTPError.