1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-21 23:42:23 +00:00
9 Mass Delete via API
Gonzalo Peci edited this page 2017-09-15 18:13:52 +02:00

This article can be removed when Mass Delete is implemented

For those who need to remove a lot of movie entries from radarr after they have finished downloading to their preferred quality. At the moment this can either be done via the API, or a lot of clicking on the webui. Bash 3.0+ required. First, pull the list of movies with GET:

curl https://example.com/radarr/api/movie -X GET -H 'X-Api-Key: xxxxxxxxx' -k > api.txt

This will create api.txt and enter the json response, where you can browse at your leisure. Use sed to whittle down the list:

cat api.txt| jq '.[] | .id' > todelete.txt

JQ Allows for filtering items based on their attributes:

cat api.txt| jq '.[] | select(.monitored | not) | .id' > todelete.txt

would add all movies there monitored is not TRUE.

The first indented column is the main id that radarr uses, the other indented id's are irrelevent: ` api.txt

"id": 4  

    "id": 7  

"id": 68    

"id": 93  

    "id": 2`

So, id's 4, 68 and 93 are the id's required for the next step.


From file list Example
for i in $(cat todelete.txt); do curl https://example.com/radarr/api/movie/$i -H 'X-Api-Key: xxxxxxxxx' -X DELETE -k; done

Oneshot example
for i in 4 68 93; do curl https://example.com/radarr/api/movie/$i -X DELETE -H 'X-Api-Key: xxxxxxxxx' -k; done

Usage:

  • example.com - your url/hostname where radarr is served from
  • X-Api-Key - Your API key found from https://example.com/radarr/settings/general

Sequential Delete
for i in $(seq x y); do curl https://example.com/radarr/api/movie/$i -X DELETE -H 'X-Api-Key: xxxxxxxxx' -k; done

Usage:

  • x - first id in series
  • y - last id in series

This will remove all movies with id's from the start to the end of the series. You may encounter "message": "Movie with ID 241 does not exist" errors.

Expected response
For either method shown above, a successful delete will print {}.


Automatically delete all unmonitored movies

In order to automate deletion of all unmonitored movies, use the following script at your own risk:

https://gist.github.com/pstadler/bc0afefe35f608e9552e764b31f45f19 (requires jq)