• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Support Troubleshooting SOLVED: Unable To POST an UserData Update

     
    • 0 Vote(s) - 0 Average

    SOLVED: Unable To POST an UserData Update

    Getting 404 Not Found - HTTPError
    hieroglyph
    Offline

    Junior Member

    Posts: 4
    Threads: 2
    Joined: 2023 Nov
    Reputation: 0
    #1
    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
    • 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.
    hieroglyph
    Offline

    Junior Member

    Posts: 4
    Threads: 2
    Joined: 2023 Nov
    Reputation: 0
    #2
    2024-01-20, 04:55 PM
    My issue was using GUI generated API keys instead of Authenticating By Username via the API endpoint
    Code:
    /Users/AuthenticateByName
    jaffakke
    Offline

    Junior Member

    Posts: 1
    Threads: 0
    Joined: 2024 Dec
    Reputation: 0
    #3
    2024-12-07, 12:50 AM
    I had a very similar issue and in debugging (after seeing your comment above) I did switch from using the API key to AuthenticateByName - but I still had issues with the PlaybackPositionTicks not updating.

    What I found to be my solution was to use the endpoint /UserItems/{itemId}/UserData and post the updated UserData there. Then I found that all the UserData is updated, including the PlaybackPositionTicks
    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)


    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode