Hello, i’m trying to delete a movie from radarr with the API. I’m able de to download it via this code :
?>
<script>
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();
xhr.open("POST", "http://ip:port/api/v3/movie", true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("X-Api-Key", "api-key");
xhr.send(data_string);
}
</script>```
This function is called when clicking on a button.
But here is my code to delete :
<script>
function deleteMovie(id) {
var xhr = new XMLHttpRequest();
xhr.open("DELETE", "http://ip:port/api/v3/movie/$id?deletedFiles=true", true);
xhr.setRequestHeader("accept", "/");
xhr.setRequestHeader("X-Api-Key", "apikey");
xhr.send();
}
</script>
$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 "http://192.168.1.60:7878/api/v3/movie/$id?deleteFiles=true"
can someone help me ?