API Docs for Commands #4413

Closed
opened 2026-02-20 06:04:04 -05:00 by deekerman · 4 comments
Owner

Originally created by @mariotacke on GitHub (Feb 6, 2023).

Is there an existing issue for this?

  • I have searched the existing open and closed issues

Current Behavior

For the longest time, I could invoke /api/command/ with

{
  "name": "DownloadedEpisodeScan",
  "path": "<my import path>"
  "importMode": "move"
}

which would happily import episodes which were already matched/could be matched without user input.

This endpoint appears to no longer exists. I cannot find any commits removing it/feature replacing it or otherwise. It now returns 415 Method Not Allowed.

Expected Behavior

I've used this endpoint for many years and it was triggered via curl after an episode completed downloading. I expect to invoke this Sonarr command which then scans the provided path, and perform the import as it would if triggered via the UI.

Steps To Reproduce

curl -vvvvv https://my-sonarr/api/command -X POST --header "X-Api-Key:<api key>" -d '{"name":"DownloadedEpisodesScan","path":"/watch/Some.Episode.Folder/","importMode":"Move"}'

Environment

- OS: Ubuntu/docker
- Sonarr: 4.0.0.369
- Docker Install: Docker version 20.10.6, build 370c289
- Using Reverse Proxy: no
- Browser: curl

What branch are you running?

Develop

Trace Logs?

No trace logs are generated when hitting the endpoint. It appears to have been removed entirely.

Anything else?

Looking at the UI network traffic, it appears to now require a two step process:

  1. Invoke GET /api/v3/manualimport?folder=&filterExistingFiles=true
  2. The frontend client then generates a POST payload and submits it to: POST /api/v3/command {"files":[{"...a fairly complex object to perform the import"}],importMode:"move","name":"ManualImport"}

Is there a way to auto-generate the "simple" DownloadedEpisodeScan behavior from before? Are all fields required in the "ManualImport" command?

Originally created by @mariotacke on GitHub (Feb 6, 2023). ### Is there an existing issue for this? - [X] I have searched the existing open and closed issues ### Current Behavior For the longest time, I could invoke `/api/command/` with ``` { "name": "DownloadedEpisodeScan", "path": "<my import path>" "importMode": "move" } ``` which would happily import episodes which were already matched/could be matched without user input. This endpoint appears to no longer exists. I cannot find any commits removing it/feature replacing it or otherwise. It now returns 415 Method Not Allowed. ### Expected Behavior I've used this endpoint for many years and it was triggered via curl after an episode completed downloading. I expect to invoke this Sonarr command which then scans the provided path, and perform the import as it would if triggered via the UI. ### Steps To Reproduce ``` curl -vvvvv https://my-sonarr/api/command -X POST --header "X-Api-Key:<api key>" -d '{"name":"DownloadedEpisodesScan","path":"/watch/Some.Episode.Folder/","importMode":"Move"}' ``` ### Environment ```markdown - OS: Ubuntu/docker - Sonarr: 4.0.0.369 - Docker Install: Docker version 20.10.6, build 370c289 - Using Reverse Proxy: no - Browser: curl ``` ### What branch are you running? Develop ### Trace Logs? No trace logs are generated when hitting the endpoint. It appears to have been removed entirely. ### Anything else? Looking at the UI network traffic, it appears to now require a two step process: 1. Invoke GET /api/v3/manualimport?folder=<folder>&filterExistingFiles=true 2. The frontend client then generates a POST payload and submits it to: POST /api/v3/command {"files":[{"...a fairly complex object to perform the import"}],importMode:"move","name":"ManualImport"} Is there a way to auto-generate the "simple" DownloadedEpisodeScan behavior from before? Are all fields required in the "ManualImport" command?
deekerman 2026-02-20 06:04:04 -05:00
  • closed this issue
  • added the
    docs
    label
Author
Owner

@mariotacke commented on GitHub (Feb 6, 2023):

Found this https://github.com/Sonarr/Sonarr/issues/3599#issuecomment-594105342 from March 3, 2020 which suggests the approach above.

@mariotacke commented on GitHub (Feb 6, 2023): Found this https://github.com/Sonarr/Sonarr/issues/3599#issuecomment-594105342 from March 3, 2020 which suggests the approach above.
Author
Owner

@mariotacke commented on GitHub (Feb 6, 2023):

Appending --header "Content-Type: application/json; charset=utf-8" seems to have remedied the issue (wasn't needed in the past). Still curious why this command is undocumented/no commits exists for it?

@mariotacke commented on GitHub (Feb 6, 2023): Appending `--header "Content-Type: application/json; charset=utf-8"` seems to have remedied the issue (wasn't needed in the past). Still curious why this command is undocumented/no commits exists for it?
Author
Owner

@markus101 commented on GitHub (Feb 7, 2023):

As you've discovered, nothing has happened to it. and you can see it in use via Manual Import's Move Automatically from Wanted: Missing. The change in behaviour is likely due to the new libraries being used in v4.

The individual commands aren't currently tracked in the API docs, the old v2 API were removed as they are woefully out of date. https://sonarr.tv/docs/api/

@markus101 commented on GitHub (Feb 7, 2023): As you've discovered, nothing has happened to it. and you can see it in use via Manual Import's Move Automatically from Wanted: Missing. The change in behaviour is likely due to the new libraries being used in v4. The individual commands aren't currently tracked in the API docs, the old v2 API were removed as they are woefully out of date. https://sonarr.tv/docs/api/
Author
Owner

@mariotacke commented on GitHub (Feb 9, 2023):

Thanks @markus101. Looking forward to the new docs documenting the commands eventually.

@mariotacke commented on GitHub (Feb 9, 2023): Thanks @markus101. Looking forward to the new docs documenting the commands eventually.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Sonarr#4413
No description provided.