Library updated API not working

Brand new Jellyfin user here. I’m hitting an issue getting the API to add new files to the library, and I can’t figure out if I’m doing something wrong or if I’ve found a bug.

I’m continually recording TV shows to a folder which is setup as a library in Jellyfin, and I would like to add these shows to Jellyfin when they finish recording. The scheduled library refresh is adding shows before they’ve finished recording, and before the NFO has been written which happens when the recording finishes, so I would like to turn this off and use the API instead so incomplete shows don’t appear.

My trouble is the API doesn’t seem to be doing anything, even though I think I’m using it correctly. The files I tell it to add don’t get added to the library.

This is the URL I’m calling (with the correct IP and API key):
http://1.2.3.4:8096/mediabrowser/Library/Media/Updated?api_key=XXX

And this is the data I’m posting in the body:
{“Updates”:[{“Path”:"/media/recordings/other/test.mkv",“UpdateType”:“Created”}]}

The API returns a 204 response which suggests it’s succeded, but the library doesn’t change at all. Nothing gets logged, even with debug logging on. The path is correct and the new file is picked up if I do a library refresh.

So does anyone have any idea why it isn’t working? I’m running Jellyfin on Docker on Ubuntu if that makes any difference.

I’m not sure off the top of my head. I would look into the code that Sonarr used to notify Emby of a file update, because that should work.

Thanks for this, with the help of Sonarr I’ve figured out what was going on. I was sending the API key in the URL, but to get it to work I had to send it via a header instead. Now I’m using the header it’s working.

I’m guessing there is a small bug here as the API was returning a 204 response as if it had accepted the API key, so it’s clearly validating the API key but then not using it. If it had returned 401 (unauthorised) it would have been more obvious what wasn’t working.

If you’re using the nightly, that’s something we’ve just recently fixed. If you’re using the stable version, well it’s fixed in the next one! :slight_smile:

1 Like