V3 API add series request example?

Sonarr version (exact version):
Mono version (if Sonarr is not running on Windows):
OS: Windows 10
Debug logs:
Description of issue: API call to add series returns 200 and no data, but does not add the series.

I have used the v3 API documentation to create a GET url for adding a series to Sonarr by tvdbId. I use it in PHP to create links for shows I don’t have, and if you click on the show it (should) add the show to Sonarr. When I click on the link, I get a blank array returned: “[]” and the show has not been added to Sonarr.

I’ve tried just directly calling the link when clicked on: (e.g. http://example.com:8989/api/v3/series?tvdbId=12345&includeSeasonImages=false&apikey={apiKey inserted here}), and I’ve tried using curl and setting the api key and tvdbid.

Both report back that 200 was received, but the result is [], and nothing is added.

Can someone point me to a good working example of adding a show by tvdbid number to Sonarr? Do I need to get all the series data first and then send that? Or does the API handle it?

The apikey needs to be passed in the header of your request.

The easiest (at least for me) is to use the dev console of your browser and take the action you want to automate in sonarr to see what is sent to/from the api.

Full api docs: Sonarr API Docs

Thanks for getting back to me. I do pass the apikey in the header. I have gotten other functions to work, but I think it’s the POST command or curl that’s throwing me.

I figured out what little I know of working with the API by using the Sonarr API Docs to generate the requests for me, but this one eludes me.

Do I need to add everything about the series or is there a basic way to add the TV show (series) by tvdbId?

OK, so using ChatGPT and copying the curl command from the documentation, I’ve got it actually sending the POST command and getting a response.

But my response is always Invalid Path for RootFolderPath. I’ve tried everything, but it’s not working.

  • Tried leaving it blank and it throws an error about the RootFolderPath being missing and required.
  • Tried using the whole path to the folder Sonarr sees TV in: E:/VIDEO/TV.
  • Tried adding the slash to the end: E:/VIDEO/TV/
  • Tried using the folder I want the series in: E:/VIDEO/TV/Batman (1966)
  • Tried adding the slash to the end: E:/VIDEO/TV/Batman (1966)/
  • Tried using just the local series folder I want: /Batman (1966)
  • Tried it without the leading slash: Batman (1966)

I absolutely cannot get the API to accept a RootFolderPath and add the series. Has anyone gotten this to work? Any idea what I need to put in there?

(In case it matters, I’m running Windows, and this is NOT a mapped folder, it’s a direct, internal folder with drive letter: E:)

OK, so I figured it out. It’s a string issue with php and json. In order to get it to work, I had to escape double slashes, so it takes 4 of them:

“E:\\VIDEO\\TV” (see, even here when I use four in a row, it gets changed into just the two I needed. LOL)

E:\\\\VIDEO\\\\TV (this is what it looks like in my code)
This worked, added my show, but even then it returned “{ “message”: “NotAcceptable” }” even though it did work.

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