URL to shut down NzbDrone via http from script

Is there a way that I can tell NzbDrone to shut down (normally) via an HTTP call (curl, etc.) via a script? I’m not web-savvy enough to figure out the URL that gets called when I click the ‘shutdown’ button.

Poked around the API section of the wiki, but didn’t find what I was looking for.

TIA
LJS

You need to send a command: https://github.com/NzbDrone/NzbDrone/wiki/Command

The command name is: ‘shutdown’

cool – I was at that page… didn’t see anything referencing shutdown… is it there and I missed it?

THe only instance of ‘down’ I can find at all is inside “DownloadedEpisodesScan”

OK – Tried to figure out a command to send (and how to send it) and came up with this: http://server:8989/api/command -X POST -d ‘{“name”: “shutdown”}’ --header “X-Api-Key:blahblahblah” (note I’m calling this from a browser currently… not sure if the formatting is correct…

it asks me for a username/password… I don’t have any kind of authentication enabled, so I’m kinda confused.

Thanks again for any help!

No, its not currently listed there.

You can’t call it from your browser, you need to send a POST request, you’e getting a prompt for a password because the API key was not included with the request.

You can send the command from curl or another application that supports POST.

I’m sending a POST command from a remote browser using a Chrome extension, but NZBDrone in response pops up a message asking for the username and password, though I don’t have them enabled. I’ve tried it with and without passing the API key and it makes no difference.
Here’s the POST command i’m sending: http://server/api/command -X POST -d '{“name”: “shutdown”}'
Any idea why it asks for a username/pw and how to fix that?

How are you passing the API key? drone is returning a 401 not authenticated and Chrome pops up a basic auth prompt, but its the lack of an API key or an incorrect one that causes the issue.

Using a browser extension called Postman for chrome, which sends post requests. I tried passing the API key with this command:
http://server:8989/api/command -X POST -d ‘{“name”: “shutdown”}’ --header "X-Api-Key:apikey"
and I also tried sending it as a header and value, which didn’t pop up the password prompt but returned an error message saying “method not allowed”

Sorry, we change it because commands were getting blocked and not executing, you can issue a POST to:

/api/system/shutdown - shutdown drone
/api/system/restart - restart drone

You will need the API key, which does work when you set it as a header (I use postman all the time with drone).

I tried that, no error, but no shutdown either. The command I passed was: “http://server:8989/api/system/shutdown”, with the header X-Api-Key and the value is the key. Does it matter that I’m running on a mac with mono?

Does shutdown work from the UI? Thats the same command the UI sends to the server to shutdown.