Does the Plex emptyTrash URL call no longer work?

Hi,

I previously used the emptyTrash webcall to schedule an emptyTrash process to avoid it running when my NAS was disconnected. This was whilst running on Windows.

I have since moved Plex to Docker and want to reinstate this behaviour.

I have a strange situation.

This works; http://“ip”:32400/library/sections/1/refresh?X-Plex-Token=“token”

This does not work; http://“ip”:32400/library/sections/1/emptyTrash?X-Plex-Token=“token”

Has anyone experienced the same?

Any solution available?

Thanks!

It seems like it may well be the case based on this topic; Refresh endpoint PUT/POST requests started throwing 404s in version 1.32.7.7484 - #6 by obelisk3847

How can i schedule an emptyTrash task now?

Maybe use cURL to create a proper GET request?
(I have not tested this. This is just what I can fetch from the linked threads.)

When finding valid endpoints, I always simply use the web client, and look in the debugger to see the relevant call

So make sure you use a PUT method for empty of the trash, and can as @OttoKerner said be done using Curl or wget

I was using curl and PUT in my .sh script, but was trying to test the validity of the url by using my web browser.

The original request actually still works when i use it in the script.

This is my script for anyone interested

#!/bin/bash

# Empty Libraries
# Forces all the Plex libraries to empty their trash

# Each of the libraries you wish to empty separated by a space. To find
# the IDs hover the mouse over the library in Plex Web and look for the
# bit in at the end of the URL which is source=XX - with XX being the ID
libraries="1 2 3 4"

# The URL required to access Plex. Use 127.0.0.1 to mean "the same machine"
url="http://xxx.xxx.x.xxx:32400"

# Your Plex token, which can be found with the following instructions
# https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
token="<token>"

# ----- Code starts here -----

for l in $libraries; do
    if [ -d "/synology/video/Shared Videos/PlexServer/Scripts" ]
    then
        echo "Emptying library ID $l"
        curl -X PUT "$url/library/sections/$l/emptyTrash?X-Plex-Token=$token"
    else
        echo "Error: Directory does not exist"
    fi
done

echo "Finished"

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.