cURL and Qt JSON formatting submit order issue

Developing order entry and I’m always getting code 400 , msg: “request body format is invalid”.

Here’s my full curl command and JSON order string (windows):

curl --request POST -H “Content-Type: application/json” -H “APCA-API-KEY-ID: BLAH” -H “APCA-API-SECRET-KEY: BLAH/BLAH” -d “{“symb”:“AAPL”,“qty”:“1”,“side”:“buy”,“type”:“market”,“time_in_force”:“gtc”}”

I’ve gotten several other GET requests working fine. Also tried diligently with Qt. Was successful with the python SDK, but couldn’t dump the actual POST command that goes out.

Does anything obviously stand out as wrong?

Thanks for any help in advanced,


Try single quotes to quote json body in your curl example?

I’ve tried single quotes, double quotes, triple quotes, delimited quotes , unlimited quotes and every other kind of quote there is… I tried the python sdk source which got me further into construction the POST message, but the debugger doesn’t step into Requests. I even switched to a mac computer and tried everything again.

On to wireshark… unless someone could test out curl on their computer?

@josh_t, I’m just getting started with the API, and your question is a top result for the search “ curl”. It’s not very helpful that you did not use code-block for your command, so your copy-pasting your command requires editing to change the quotes.

If I change the quotes to the correct ones I get the error {"code":40010001,"message":"symbol is required"}, meaning you used symb where symbol was required in JSON. Here’s a working example, which hopefully the future readers can copy-paste while using their own variables.


curl --request POST \
  -H "Content-Type: application/json" \
  -d '{"symbol":"AAPL","qty":"1","side":"buy","type":"market","time_in_force":"gtc"}' \