EpisodeFile API Error

I am having an issue getting the file info from the API. Any thoughts?

URL
http://[SONARR_URL]/api/episodefile?apikey=[APIKEY]&id=10453

{
“message”: “Object reference not set to an instance of an object”,
“description”: "System.NullReferenceException: Object reference not set to an instance of an object\n at Nancy.DynamicDictionaryValue.op_Implicit (Nancy.DynamicDictionaryValue dynamicValue) <0x42033cd0 + 0x0000f> in :0 \n at (wrapper dynamic-method) System.Object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object)\n at (wrapper delegate-invoke) :invoke_bound_Nullable1<int>_Closure_CallSite_object (System.Runtime.CompilerServices.CallSite,object)\n at NzbDrone.Api.EpisodeFiles.EpisodeModule.GetEpisodeFiles () [0x0000d] in m:\\BuildAgent\\work\\6c3239faf2b92630\\src\\NzbDrone.Api\\EpisodeFiles\\EpisodeFileModule.cs:55 \n at NzbDrone.Api.REST.RestModule1[TResource].<set_GetResourceAll>b__c (System.Object options) [0x00000] in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Api\REST\RestModule.cs:111 \n at (wrapper dynamic-method) System.Object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Func`2<object, object>,object)\n at Nancy.Routing.Route+<>c__DisplayClass4.b__3 (System.Object parameters, CancellationToken context) <0x41fb7700 + 0x0014f> in :0 "
}

Your request is wrong, it should be http://[SONARR_URL]/api/episodefile/10453?apikey=[APIKEY]

I thought so, but I was getting

{
“message”: “NotFound”
}

as my response.

Looking into it further, it seems i need to provide the episodeFileId, not the EpisodeID

Thanks for your help.

PS: http://[SONARR_URL]/api/episode/10453?apikey=[APIKEY]
does include the episodeFile object

Yeah, that might change in v3 (though it will be done in a way that won’t immediately affect the current call).

Good to know, I have modified my code to use the proper Episode File via the File ID now.

Question: To delete a file, is it episodefile/delete/{id}?

And that triggers the standard “move to a folder dont actually delete it” functions if setup correctly, correct?

No, just the HTTP DELETE verb on episodefile/{id}. It’s a REST api.

ha! I have been connecting to Read Only REST APIs so much I did not even realize there was a DELETE option for HTTP lol.

Thanks for answering the dumb question!

Excellent, worked like a charm

Deleted 200gb of old shows.

I wrote a program to link up Sonarr with Kodi, find all the shows (that I don’t want to keep) and mark all the episodes that have been watched for deletion. Then I can delete them in bulk, or one at a time after I review them.

I wrote more about it here: Anyone interested in a Kodi "watched" flag in Sonarr?

Excellent.

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