I just wanted to add something for anyone else who see’s this post and wants to know how to manually import into Sonarr via the API, because at first, without much knowledge in this area, people can be put off easily.
First, you need to connect to the API, which is “YOUR_SONARR_ADDRESS/API”, then depending on the function you’re looking to use, such as “DownloadEpisodeScan” found under “command” in the wiki, you will add “/command” to that address.
Now, depending on how you plan to connect to Sonarr, be it cURL, xmlhttp etc… you will need to include the API key, you can add the key through the header or directly using the url, examples.
curl --header "X-Api-Key: YOUR_API_KEY"
xmlhttp.setRequestHeader “X-Api-Key”, "YOUR_API_KEY"
SONARR_ADDRESS/API/Command/?apikey=YOUR_API_KEY
Now, each API function works differently, when you use “command” you will be sending your sonarr instruction in json format, in the case of “DownloadEpisodeScan”, it would look something like this.
{“name”: “DownloadEpisodeScan”, “path”: “path/to/file”, “downloadClientId”: “nzoid for SABnzb or Torrent Hash”, “importMode”: “Move|Copy”}
You don’t need the “downloadClientId”, but if it’s currently in your client and you want sonarr to handle it, then you can include it.
To rename the file for sonarr, you can use Filebot, manually do it yourself or find/create a script that will use something like TVDB to make the files more readable for sonarr, although based on my own experience, sonarr hasn’t had much trouble renaming files on its own.
As for the script, if it was me, I would have a label called “SonarrManual” or something, then have a script listen for completed downloads with that label, each download then gets put into a text file with the location and downloadClientId, so when I run the manual script, it would loop through the text file, that way sonarr can handle my manual imports and the text file would act like a queue, each time one is successfully imported, it is removed from the text file and the script rechecks after each import, so if more manual imports get added to the file, it would just keep importing until complete.
Hope this helps.