Jump to content

Delete items using the emby API


amateurgod

Recommended Posts

amateurgod

i keep getting this error while trying to delete items using the emby API
 

Quote

Failed to delete item {Item_ID} from Emby: 400, Value cannot be null. (Parameter 'user')


however, the API docs don't say that this API endpoint requires a user parameter

Here is my code for this section

def delete_item(item_id):

    url = f"{EMBY_URL}/Items"

    params = {

        'Ids': item_id,

        'api_key': EMBY_API_KEY

    }

    response = requests.delete(url, params=params)

    if response.status_code == 200:

        print(f"Item {item_id} deleted successfully from Emby.")

    else:

        print(f"Failed to delete item {item_id} from Emby: {response.status_code}, {response.text}")

 

Edited by amateurgod
fix code block
Link to comment
Share on other sites

amateurgod

i fixed it, the solution was to not pass them as params and just put them in the URL like so 

 

def delete_item(item_id):
    url = f"{EMBY_URL}/Items?{item_id}&api_key={EMBY_API_KEY}"
    response = requests.delete(url)
    if response.status_code == 204:
        print(f"Item {item_id} deleted successfully from Emby.")
    else:
        print(f"Failed to delete item {item_id} from Emby: {response.status_code}, {response.text}")

 

Link to comment
Share on other sites

amateurgod

oh actually nevermind, i thought i fixed it however its marking items as deleted in emby but not deleting them from the local filesystem

the logs arent showing any errors either 

 

2024-02-10 14:25:43.614 Info Server: http/1.1 DELETE http://host3/emby/Items?=95688&api_key=x_secret5_x. UserAgent: python-requests/2.25.1 2024-02-10 14:25:43.615 Info Server: http/1.1 Response 204 to host4. Time: 0ms. DELETE http://host3/emby/Items?=95688&api_key=x_secret5_x 2024-02-10 14:25:44.035 Info Server: http/1.1 DELETE http://host3/emby/Items?=95684&api_key=x_secret5_x. UserAgent: python-requests/2.25.1 2024-02-10 14:25:44.035 Info Server: http/1.1 Response 204 to host4. Time: 1ms. DELETE http://host3/emby/Items?=95684&api_key=x_secret5_x 2024-02-10 14:25:44.532 Info Server: http/1.1 DELETE http://host3/emby/Items?=94845&api_key=x_secret5_x. UserAgent: python-requests/2.25.1 2024-02-10 14:25:44.533 Info Server: http/1.1 Response 204 to host4. Time: 1ms. DELETE http://host3/emby/Items?=94845&api_key=x_secret5_x 2024-02-10 14:25:45.080 Info Server: http/1.1 DELETE http://host3/emby/Items?=94833&api_key=x_secret5_x. UserAgent: python-requests/2.25.1

 

Link to comment
Share on other sites

adminExitium

AFAIK, you need to use the User Items endpoint like /Users/<UserID/Items/<ItemID> for deleting an item.

Link to comment
Share on other sites

amateurgod
4 minutes ago, adminExitium said:

AFAIK, you need to use the User Items endpoint like /Users/<UserID/Items/<ItemID> for deleting an item.

oh the api docs says you can use the item endpoint
image.thumb.png.a00f1afdebf82b0af30c11c08179f883.png

Link to comment
Share on other sites

adminExitium

That may still work but it needs to be done as a user like /Users/<UserID/Items?Ids=<ItemID>

Link to comment
Share on other sites

amateurgod
27 minutes ago, adminExitium said:

That may still work but it needs to be done as a user like /Users/<UserID/Items?Ids=<ItemID>

i tried that endpoint and i get an error 404 where as my original endpoint worked, it deleted the files in emby from the library just wasnt deleting them from the file system too 

Link to comment
Share on other sites

Try posting to Items/Delete. This is the newest one because it accepts multiple.

Link to comment
Share on other sites

  • 2 months later...
artstar
On 2/11/2024 at 7:24 AM, Luke said:

Try posting to Items/Delete. This is the newest one because it accepts multiple.

Unfortunately, that yields the same error: Value cannot be null (Parameter 'user')

It performs no different to a DELETE request, be it from Python-request or cURL. Swagger seems to have no problem via my desktop computer, for whatever strange reason.

Link to comment
Share on other sites

amateurgod
On 10/02/2024 at 13:57, amateurgod said:

i fixed it, the solution was to not pass them as params and just put them in the URL like so 

 

def delete_item(item_id):
    url = f"{EMBY_URL}/Items?{item_id}&api_key={EMBY_API_KEY}"
    response = requests.delete(url)
    if response.status_code == 204:
        print(f"Item {item_id} deleted successfully from Emby.")
    else:
        print(f"Failed to delete item {item_id} from Emby: {response.status_code}, {response.text}")

 

@artstardid you try this way? 

Link to comment
Share on other sites

artstar
14 minutes ago, amateurgod said:

@artstardid you try this way? 

Absolutely. In fact, it is your code I'm working with (thanks again, by the way!). Your way gives a 204 but it does not remove the file from disk. Hence, I edited your API call to the other approach as indicated by Swagger, as well as Luke's POST suggestion. All of them fail in the manner shown below.

@LukeApologies, I neglected to paste an excerpt from the log:

2024-04-30 22:55:31.522 Info Server: http/1.1 DELETE http://‌‍‍emby.FQDN.redacted/emby/Items/405688?api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌. UserAgent: python-requests/2.31.0
2024-04-30 22:55:31.523 Debug SqliteItemRepository: GetitemById Episode 405688 /mnt/emby/TV/[filename]
2024-04-30 22:55:31.523 Error Server: Error processing request
        *** Error Report ***
        Version: 4.8.5.0
        Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
        Operating system: Linux version 5.15.0-101-generic (buildd@lcy02-amd64-032) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #111-Ubun
        Framework: .NET 6.0.25
        OS/Process: x64/x64
        Runtime: opt/emby-server/system/System.Private.CoreLib.dll
        Processor count: 2
        Data path: /var/lib/emby
        Application path: /opt/emby-server/system
        System.ArgumentNullException: System.ArgumentNullException: Value cannot be null. (Parameter 'user')
           at MediaBrowser.Controller.Entities.BaseItem.GetShareLevel(User user)
           at Emby.Api.Library.LibraryService.Any(DeleteItems request)
           at Emby.Api.Library.LibraryService.Any(DeleteItem request)
           at Emby.Server.Implementations.Services.ServiceController.<>c__DisplayClass8_0.<VoidActionDelegate>b__0(Object service, Object request)
           at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req, Type serviceType)
           at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
           at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
        Source: MediaBrowser.Controller
        TargetSite: MediaBrowser.Model.Dto.UserItemShareLevel GetShareLevel(MediaBrowser.Controller.Entities.User)

Link to comment
Share on other sites

amateurgod
Posted (edited)
5 hours ago, artstar said:

Absolutely. In fact, it is your code I'm working with (thanks again, by the way!). Your way gives a 204 but it does not remove the file from disk. Hence, I edited your API call to the other approach as indicated by Swagger, as well as Luke's POST suggestion. All of them fail in the manner shown below.

@LukeApologies, I neglected to paste an excerpt from the log:

2024-04-30 22:55:31.522 Info Server: http/1.1 DELETE http://‌‍‍emby.FQDN.redacted/emby/Items/405688?api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌. UserAgent: python-requests/2.31.0
2024-04-30 22:55:31.523 Debug SqliteItemRepository: GetitemById Episode 405688 /mnt/emby/TV/[filename]
2024-04-30 22:55:31.523 Error Server: Error processing request
        *** Error Report ***
        Version: 4.8.5.0
        Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
        Operating system: Linux version 5.15.0-101-generic (buildd@lcy02-amd64-032) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #111-Ubun
        Framework: .NET 6.0.25
        OS/Process: x64/x64
        Runtime: opt/emby-server/system/System.Private.CoreLib.dll
        Processor count: 2
        Data path: /var/lib/emby
        Application path: /opt/emby-server/system
        System.ArgumentNullException: System.ArgumentNullException: Value cannot be null. (Parameter 'user')
           at MediaBrowser.Controller.Entities.BaseItem.GetShareLevel(User user)
           at Emby.Api.Library.LibraryService.Any(DeleteItems request)
           at Emby.Api.Library.LibraryService.Any(DeleteItem request)
           at Emby.Server.Implementations.Services.ServiceController.<>c__DisplayClass8_0.<VoidActionDelegate>b__0(Object service, Object request)
           at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req, Type serviceType)
           at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
           at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
        Source: MediaBrowser.Controller
        TargetSite: MediaBrowser.Model.Dto.UserItemShareLevel GetShareLevel(MediaBrowser.Controller.Entities.User)

Odd as it was deleting files on my system (during testing), I did have an issue at first where it wasn't deleting files, however this was a permissions issue for me as on my system the files are owned by user: media and group:media while emby runs as user:emby and group:media and while the group has the same permission to the files as the user does so should have been able to delete them this wasn't working on mine, however I changed emby to run as user:media and this seemed to have been working the last time I checked. 

 

However I use sonarr and radarr to delete them on my system as that notifies emby of the deletion, where as deleting them in emby didn't notify sonarr/radarr so they thought the show still had files until I manually rescanned the show. 

When im able to I'll do some testing with the different endpoints and see if I can find a solution for you 

Edited by amateurgod
Link to comment
Share on other sites

artstar
5 hours ago, amateurgod said:

However I use sonarr and radarr to delete them on my system as that notifies emby of the deletion, where as deleting them in emby didn't notify sonarr/radarr so they thought the show still had files until I manually rescanned the show. 

When im able to I'll do some testing with the different endpoints and see if I can find a solution for you 

Ordinarily, I would allow Sonarr and Radarr to manage that for me too but those are riding on my seedbox whilst the Emby server is on-premise with no connection to them, so I can watch directly off the NAS instead of stream over the internet.

I appreciate you looking into this. For me, it was reporting that it would not do anything with the episode in question, per my example below. It responds with a 204 but it does not actually execute the file deletion.

2024-05-01 20:14:19.848 Info Server: http/1.1 DELETE http://‌‍‍[redacted]/emby/Items?=405688&api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌. UserAgent: python-requests/2.31.0
2024-05-01 20:14:19.849 Info Server: http/1.1 Response 204 to ‌‍‍[redacted]. Time: 1ms. DELETE http://‌‍‍[redacted]/emby/Items?=405688&api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌
2024-05-01 20:14:27.716 Info Server: http/1.1 DELETE http://‌‍‍[redacted]/emby/Items?=404793&api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌. UserAgent: python-requests/2.31.0
2024-05-01 20:14:27.716 Info Server: http/1.1 Response 204 to ‌‍‍[redacted]. Time: 0ms. DELETE http://‌‍‍[redacted]/emby/Items?=404793&api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌
 

However, when I change the API call from /Items?={item_id} to /Items/{item_id}?api_key=xxxxxxxx, then it does actually attempt to work with that item ID but demands the 'user' parameter cannot be null.

2024-05-01 20:20:11.084 Info Server: http/1.1 DELETE http://‌‍‍[redacted]/emby/Items/405688?api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌. UserAgent: python-requests/2.31.0
2024-05-01 20:20:11.084 Debug SqliteItemRepository: GetitemById Episode 405688 /mnt/emby/TV/[redacted]/Season 1/S01E08 - [redacted].mkv
2024-05-01 20:20:11.085 Error Server: Error processing request
        *** Error Report ***
        Version: 4.8.5.0
        Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
        Operating system: Linux version 5.15.0-101-generic (buildd@lcy02-amd64-032) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #111-Ubun
        Framework: .NET 6.0.25
        OS/Process: x64/x64
        Runtime: opt/emby-server/system/System.Private.CoreLib.dll
        Processor count: 2
        Data path: /var/lib/emby
        Application path: /opt/emby-server/system
        System.ArgumentNullException: System.ArgumentNullException: Value cannot be null. (Parameter 'user')
           at MediaBrowser.Controller.Entities.BaseItem.GetShareLevel(User user)
           at Emby.Api.Library.LibraryService.Any(DeleteItems request)
           at Emby.Api.Library.LibraryService.Any(DeleteItem request)
           at Emby.Server.Implementations.Services.ServiceController.<>c__DisplayClass8_0.<VoidActionDelegate>b__0(Object service, Object request)
           at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req, Type serviceType)
           at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
           at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
        Source: MediaBrowser.Controller
        TargetSite: MediaBrowser.Model.Dto.UserItemShareLevel GetShareLevel(MediaBrowser.Controller.Entities.User)

 

It has me wondering why Swagger could get it to work but copy+paste of the Swagger cURL output yields this result.

Link to comment
Share on other sites

amateurgod
40 minutes ago, artstar said:

Ordinarily, I would allow Sonarr and Radarr to manage that for me too but those are riding on my seedbox whilst the Emby server is on-premise with no connection to them, so I can watch directly off the NAS instead of stream over the internet.

I appreciate you looking into this. For me, it was reporting that it would not do anything with the episode in question, per my example below. It responds with a 204 but it does not actually execute the file deletion.

2024-05-01 20:14:19.848 Info Server: http/1.1 DELETE http://‌‍‍[redacted]/emby/Items?=405688&api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌. UserAgent: python-requests/2.31.0
2024-05-01 20:14:19.849 Info Server: http/1.1 Response 204 to ‌‍‍[redacted]. Time: 1ms. DELETE http://‌‍‍[redacted]/emby/Items?=405688&api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌
2024-05-01 20:14:27.716 Info Server: http/1.1 DELETE http://‌‍‍[redacted]/emby/Items?=404793&api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌. UserAgent: python-requests/2.31.0
2024-05-01 20:14:27.716 Info Server: http/1.1 Response 204 to ‌‍‍[redacted]. Time: 0ms. DELETE http://‌‍‍[redacted]/emby/Items?=404793&api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌
 

However, when I change the API call from /Items?={item_id} to /Items/{item_id}?api_key=xxxxxxxx, then it does actually attempt to work with that item ID but demands the 'user' parameter cannot be null.

2024-05-01 20:20:11.084 Info Server: http/1.1 DELETE http://‌‍‍[redacted]/emby/Items/405688?api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌. UserAgent: python-requests/2.31.0
2024-05-01 20:20:11.084 Debug SqliteItemRepository: GetitemById Episode 405688 /mnt/emby/TV/[redacted]/Season 1/S01E08 - [redacted].mkv
2024-05-01 20:20:11.085 Error Server: Error processing request
        *** Error Report ***
        Version: 4.8.5.0
        Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
        Operating system: Linux version 5.15.0-101-generic (buildd@lcy02-amd64-032) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #111-Ubun
        Framework: .NET 6.0.25
        OS/Process: x64/x64
        Runtime: opt/emby-server/system/System.Private.CoreLib.dll
        Processor count: 2
        Data path: /var/lib/emby
        Application path: /opt/emby-server/system
        System.ArgumentNullException: System.ArgumentNullException: Value cannot be null. (Parameter 'user')
           at MediaBrowser.Controller.Entities.BaseItem.GetShareLevel(User user)
           at Emby.Api.Library.LibraryService.Any(DeleteItems request)
           at Emby.Api.Library.LibraryService.Any(DeleteItem request)
           at Emby.Server.Implementations.Services.ServiceController.<>c__DisplayClass8_0.<VoidActionDelegate>b__0(Object service, Object request)
           at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req, Type serviceType)
           at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
           at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
        Source: MediaBrowser.Controller
        TargetSite: MediaBrowser.Model.Dto.UserItemShareLevel GetShareLevel(MediaBrowser.Controller.Entities.User)

 

It has me wondering why Swagger could get it to work but copy+paste of the Swagger cURL output yields this result.

I would redact your API Keys from the logs btw, I know you redacted the IP/FQDN but to be safe you should redact the API key too 

Link to comment
Share on other sites

artstar

Also, to add some more food for thought, I've tried another call and I can demonstrate how this works for Swagger but not a local curl execution.

First, locally:

2024-05-01 20:59:33.963 Debug Server: http/1.1 GET http://[redacted]/Items/405688/DeleteInfo?api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌. UserAgent: curl/7.81.0
2024-05-01 20:59:33.964 Debug SqliteItemRepository: GetitemById Episode 405688 /mnt/emby/TV/[redacted]/Season 1/S01E08 - [redacted].mkv
2024-05-01 20:59:33.964 Error Server: Error processing request
        *** Error Report ***
        Version: 4.8.5.0
        Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
        Operating system: Linux version 5.15.0-101-generic (buildd@lcy02-amd64-032) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #111-Ubun
        Framework: .NET 6.0.25
        OS/Process: x64/x64
        Runtime: opt/emby-server/system/System.Private.CoreLib.dll
        Processor count: 2
        Data path: /var/lib/emby
        Application path: /opt/emby-server/system
        System.ArgumentNullException: System.ArgumentNullException: Value cannot be null. (Parameter 'user')
           at MediaBrowser.Controller.Entities.BaseItem.GetShareLevel(User user)
           at MediaBrowser.Controller.Entities.BaseItem.CanDelete(User user, Folder[] collectionFolders)
           at Emby.Api.Library.LibraryService.Get(GetDeleteInfo request)
           at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req, Type serviceType)
           at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
           at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
        Source: MediaBrowser.Controller
        TargetSite: MediaBrowser.Model.Dto.UserItemShareLevel GetShareLevel(MediaBrowser.Controller.Entities.User)

2024-05-01 20:59:33.964 Info Server: http/1.1 Response 400 to [redacted]. Time: 1ms. GET http://[redacted]/Items/405688/DeleteInfo?api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌


 

Then, Swagger:

image.thumb.png.e027e5d0d8ab9d3ae0652772f6a31c26.png

Link to comment
Share on other sites

artstar
Just now, amateurgod said:

I would redact your API Keys from the logs btw, I know you redacted the IP/FQDN but to be safe you should redact the API key too 

Nah, it's safe. This Emby server is strictly LAN. No WAN access into it and my entire network is barricaded from incoming internet on my Fortigate. :)

Link to comment
Share on other sites

svdasein

As it happens I am up against exactly this issue, so "me too!"

I can confirm that using the form Items?<itemid> does give a 204 but in fact does apparently nothing (does not delete the item).  And I am also getting the "Value cannot be null. (Parameter 'user'])" when I do it as swagger suggests.

@Lukehere's what I get in my log:

2024-05-02 16:49:56.457 Info Server: http/1.1 DELETE https://host3:8920/emby/Items?Ids=2971018&api_key=x_secret6_x. UserAgent: Faraday v2.7.4
2024-05-02 16:49:56.460 Error Server: Error processing request
        *** Error Report ***
        Version: 4.8.5.0
        Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage em
by-server-deb_{version}_amd64.deb
        Operating system: Linux version 5.4.0-73-generic (buildd@lcy01-amd64-019) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021
        Framework: .NET 6.0.25
        OS/Process: x64/x64
        Runtime: opt/emby-server/system/System.Private.CoreLib.dll
        Processor count: 16
        Data path: /var/lib/emby
        Application path: /opt/emby-server/system
        System.ArgumentNullException: System.ArgumentNullException: Value cannot be null. (Parameter 'user')
           at MediaBrowser.Controller.Entities.BaseItem.GetShareLevel(User user)
           at Emby.Api.Library.LibraryService.Any(DeleteItems request)
           at Emby.Server.Implementations.Services.ServiceController.<>c__DisplayClass8_0.<VoidActionDelegate>b__0(Object service, Object request)
           at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req, Type serviceType)
           at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, RestPath restPath, String re
sponseContentType, CancellationToken cancellationToken)
           at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
        Source: MediaBrowser.Controller
        TargetSite: MediaBrowser.Model.Dto.UserItemShareLevel GetShareLevel(MediaBrowser.Controller.Entities.User)
        

 

  • Like 1
Link to comment
Share on other sites

6 minutes ago, svdasein said:

As it happens I am up against exactly this issue, so "me too!"

I can confirm that using the form Items?<itemid> does give a 204 but in fact does apparently nothing (does not delete the item).  And I am also getting the "Value cannot be null. (Parameter 'user'])" when I do it as swagger suggests.

@Lukehere's what I get in my log:

2024-05-02 16:49:56.457 Info Server: http/1.1 DELETE https://host3:8920/emby/Items?Ids=2971018&api_key=x_secret6_x. UserAgent: Faraday v2.7.4
2024-05-02 16:49:56.460 Error Server: Error processing request
        *** Error Report ***
        Version: 4.8.5.0
        Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage em
by-server-deb_{version}_amd64.deb
        Operating system: Linux version 5.4.0-73-generic (buildd@lcy01-amd64-019) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021
        Framework: .NET 6.0.25
        OS/Process: x64/x64
        Runtime: opt/emby-server/system/System.Private.CoreLib.dll
        Processor count: 16
        Data path: /var/lib/emby
        Application path: /opt/emby-server/system
        System.ArgumentNullException: System.ArgumentNullException: Value cannot be null. (Parameter 'user')
           at MediaBrowser.Controller.Entities.BaseItem.GetShareLevel(User user)
           at Emby.Api.Library.LibraryService.Any(DeleteItems request)
           at Emby.Server.Implementations.Services.ServiceController.<>c__DisplayClass8_0.<VoidActionDelegate>b__0(Object service, Object request)
           at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req, Type serviceType)
           at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, RestPath restPath, String re
sponseContentType, CancellationToken cancellationToken)
           at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
        Source: MediaBrowser.Controller
        TargetSite: MediaBrowser.Model.Dto.UserItemShareLevel GetShareLevel(MediaBrowser.Controller.Entities.User)
        

 

Hi, we'll take a look at it. Thanks.

  • Like 2
Link to comment
Share on other sites

19 hours ago, svdasein said:

As it happens I am up against exactly this issue, so "me too!"

I can confirm that using the form Items?<itemid> does give a 204 but in fact does apparently nothing (does not delete the item).  And I am also getting the "Value cannot be null. (Parameter 'user'])" when I do it as swagger suggests.

@Lukehere's what I get in my log:

 

It's comforting to know that it's not just me doing something stupid (wouldn't be the first time for me).

Thanks for chiming in!

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

@artstaryou haven't come up with a workaround for this have you?  I was thinking maybe "recursively delete the directory containing the movie['Path'] and then force a library rescan" - but - pretty ugly.

Link to comment
Share on other sites

17 hours ago, svdasein said:

@artstaryou haven't come up with a workaround for this have you?  I was thinking maybe "recursively delete the directory containing the movie['Path'] and then force a library rescan" - but - pretty ugly.

I could go that path but I'd rather be patient and see what Luke finds. I prefer elegant solutions wherever possible. :)

  • Thanks 1
Link to comment
Share on other sites

Happy2Play

Yes testing this the Swagger api_key works but the generated api via UI does not. 

Only change to curl command was api key generated via UI and one via Swagger session.

 

curl -X DELETE "http://localhost:8091/emby/Items?Ids={itemid}&api_key={apikey}" -d ""
Quote

 System.ArgumentNullException: Value cannot be null. (Parameter 'url')

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...