Jellyfin Forum
Library Refresh Not Working on [HttpPost("Library/Refresh")] - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+---- Forum: Networking & Access (https://forum.jellyfin.org/f-networking-access)
+---- Thread: Library Refresh Not Working on [HttpPost("Library/Refresh")] (/t-library-refresh-not-working-on-httppost-library-refresh)



Library Refresh Not Working on [HttpPost("Library/Refresh")] - haw - 2024-03-25

I've been trying to troubleshoot an external app connectivity to a new Windows 11 install of Jellyfin this weekend, particularly an HTTP post to trigger a library refresh.

As I understand, it should work for http://192.168.1.30:8096/library/refresh?api_key=xxxxx

This fails for me.

I have no issues with network reachability for devices on either end. I can file transfer and ping both directions. I've got media folder sources at the other device, which Jellyfin reads fine. My issue appears to be with the Jellyfin server config.

When I'm authenticated in the browser for Jellyfin, I should be able to navigate to http://192.168.1.30:8096/library/refresh and trigger a library refresh with a 204 response for library scan started, right?

https://github.com/jellyfin/jellyfin/blob/master/Jellyfin.Api/Controllers/LibraryController.cs

/// <summary>
    /// Starts a library scan.
    /// </summary>
    /// <response code="204">Library scan started.</response>
    /// <returns>A <see cref="NoContentResult"/>.</returns>
    [HttpPost("Library/Refresh")]
    [Authorize(Policy = Policies.RequiresElevation)]
    [ProducesResponseType(StatusCodes.Status204NoContent)]
    public async Task<ActionResult> RefreshLibrary()
    {
        try
        {
            await _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None).ConfigureAwait(false);
        }
        catch (Exception ex)
        {
            _logger.LogError(ex, "Error refreshing library");
        }

        return NoContent();
    }

When I use this URL, I get a 405 failure. I'm not sure where to look to investigate this issue further. Have I missed a setting to trigger refreshes in the web server? Am I using the wrong URL path?

My log file shows the request and session close but I only get the 405 error in the browser:

[2024-03-24 19:59:00.552 -04:00] [INF] [21] Emby.Server.Implementations.HttpServer.WebSocketManager: WS "192.168.1.169" request
[2024-03-24 20:01:02.629 -04:00] [INF] [44] Emby.Server.Implementations.HttpServer.WebSocketManager: WS "192.168.1.169" closed
[2024-03-24 20:16:26.797 -04:00] [INF] [86] Emby.Server.Implementations.HttpServer.WebSocketManager: WS "127.0.0.1" request
[2024-03-24 20:16:42.135 -04:00] [INF] [17] Emby.Server.Implementations.HttpServer.WebSocketManager: WS "127.0.0.1" closed

To be clear, I cannot trigger a refresh from (1) the remote app with the API key or (2) from an authenticated session directly in the browser.

I'd be happy to be the idiot who missed a setting somewhere but I'm at a loss here. Any guidance would be appreciated.


RE: Library Refresh Not Working on [HttpPost("Library/Refresh")] - TheDreadPirate - 2024-03-25

Keep in mind that you are looking at the master branch, which is currently the unreleased 10.9. If your setup is running 10.8.X you will need to switch to the 10.8.Z branch and make sure that your API call matches what is in the code there.


RE: Library Refresh Not Working on [HttpPost("Library/Refresh")] - haw - 2024-03-25

Thanks.

To follow up, I see identical code in the 10.8.z branch. I'm currently running 10.8.13.

https://github.com/jellyfin/jellyfin/blob/release-10.8.z/Jellyfin.Api/Controllers/LibraryController.cs


RE: Library Refresh Not Working on [HttpPost("Library/Refresh")] - haw - 2024-03-28

So, this is still driving me mad. Here's the API documentation telling me that this should work: https://api.jellyfin.org/#tag/Library/operation/RefreshLibrary