API Returning Error

January 30, 2019 555 views
API Linux Commands Ubuntu

I set up an OpenVPN server on my Ubuntu 18.10 VPS, which is working perfectly. In an attempt to lower the cost, I’m trying to set up scripts that run when my PC is booted and when it’s logged out of that turn on and off the VPS respectively, since I won’t be using it when my PC is off. I created a basic batch script to do so using cURL(which apparently is included in the Windows 10 Command Prompt) to call the DO API.
I copied the example cURL request from the API docs verbatim, replacing the API token and the droplet ID, and it returned
{"id":"bad_request","message":"Your request body was malformed."}
To ensure that authentication was working, I typed some random nonsense as the API token, which of course returned
{"id": "unauthorized", "message": "Unable to authenticate you." }
I have no idea why it’s not working, any ideas?

Be the first one to answer this question.