Javascript, Delete from radarr via API?

Hello, i’m trying to delete a movie from radarr with the API. I’m able de to download it via this code :


	function downloadMovie(tmdbId, title) {
    	var download_values = {
        	"tmdbId": tmdbId,
        	"qualityProfileId": "5",
        	"rootFolderPath": "path",
        	"monitored": true,
        	"title": title,
        	"download": true,
        	"addOptions": {
    		    "searchForMovie": true
    	var data_string = JSON.stringify(download_values);

    	var xhr = new XMLHttpRequest();"POST", "http://ip:port/api/v3/movie", true);
    	xhr.setRequestHeader("Content-Type", "application/json");
    	xhr.setRequestHeader("X-Api-Key", "api-key");

This function is called when clicking on a button.

But here is my code to delete :


    function deleteMovie(id) {

        var xhr = new XMLHttpRequest();"DELETE", "http://ip:port/api/v3/movie/$id?deletedFiles=true", true);

        xhr.setRequestHeader("accept", "/");

        xhr.setRequestHeader("X-Api-Key", "apikey");




$id is defined before.

I got this error :

Access to XMLHttpRequest at 'http://ip:port/api/v3/movie/$id?deletedFiles=true' from origin 'https://my.domain' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

i don’t really understand because when i’m trying the equivalent command on shell with curl, it’s working :

curl -vn -H "accept: */*" -H "X-Api-Key: apikey" -X DELETE "$id?deleteFiles=true"

can someone help me ?

Fixed my id variable was not correctly concatenated in the url.

I had to do this :“DELETE”, “http://ip:port/api/v3/movie/” + id + “?deleteFiles=true”, true);


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