Manual download via Api

Continuing the discussion from API - Send manual release to be download:

Hi,

I have been working on a feature for Sonarr Connect that will give users the ability to manual download releases. By using the example above i get an internal server error and if i extend it with the api key i get the following error.

XMLHttpRequest cannot load http://192.168.1.100:8989/api/release?apikey=793687589651460389181621*******. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'chrome-extension://iepihemfobgobchcdojmappkopiehkjh' is therefore not allowed access. The response had HTTP status code 500.

Is there a way to post the Release object to the release API without getting a response like this?
Thanks!

Is there an error in Sonarr’s logs?

The API does support CORS, but given the response is a 500 error it seems to have failed and the headers weren’t added.

Hi Markus,

The following error is presented in the logs of sonarr.

System.ArgumentNullException: Argument cannot be null.
Parameter name: key
at System.Collections.Concurrent.ConcurrentDictionary`2<string, NzbDrone.Common.Cache.Cached`1/CacheItem<NzbDrone.Core.Parser.Model.RemoteEpisode>>.CheckKey (string) <0x00044>
at System.Collections.Concurrent.ConcurrentDictionary`2<string, NzbDrone.Common.Cache.Cached`1/CacheItem<NzbDrone.Core.Parser.Model.RemoteEpisode>>.TryGetValue (string,NzbDrone.Common.Cache.Cached`1/CacheItem<NzbDrone.Core.Parser.Model.RemoteEpisode>&) <0x0002f>
at NzbDrone.Common.Cache.Cached`1<NzbDrone.Core.Parser.Model.RemoteEpisode>.Find (string) <0x00033>
at NzbDrone.Api.Indexers.ReleaseModule.DownloadRelease (NzbDrone.Api.Indexers.ReleaseResource) [0x00000] in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Api\Indexers\ReleaseModule.cs:56
at NzbDrone.Api.Indexers.ReleaseModule.<.ctor>b__0 (object) [0x00000] in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Api\Indexers\ReleaseModule.cs:47
at (wrapper dynamic-method) object.CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Func`2<object, object>,object) <IL 0x00038, 0x000bf>
at Nancy.Routing.Route/<>c__DisplayClass4.<Wrap>b__3 (object,System.Threading.CancellationToken) <IL 0x0005f, 0x00173>

Its failing because Sonarr doesn’t have a cached copy of release (used so less data needs to be sent to/from the client to manually grab a release).

I missed it in the OP, but currently you can’t force Sonarr to download a random release via the API, at this point I’m not sure if its something we will eventually support or not.

//cc @Taloth

Thanks for the response,

I was sending to little information to Sonarr, this is now fixed. Thanks!

Markus, I would say no, we don’t need to support it.