Finally found time to read the documentation at curl for Windows The problem seems to be that Windows always requires double quotes as the outer quotes at the command line. To use inner double quotes you have to escape them.
For example:
curl -H “Content-Type: application/json” -H “APCA-API-KEY-ID: zzzz” -H “APCA-API-SECRET-KEY: zzzz” -d ‘{“symbol”:“AAPL”,“qty”:“1”,“side”:“buy”,“type”:“market”,“time_in_force”:“gtc”}’ “https://paper-api.alpaca.markets/v2/orders”
becomes (note that POST is redundant when using -d)
curl -H “Content-Type: application/json” -H “APCA-API-KEY-ID: zzzz” -H “APCA-API-SECRET-KEY: zzzz” -d “{"symbol":"AAPL","qty":"1","side":"buy","type":"market","time_in_force":"gtc"}” “https://paper-api.alpaca.markets/v2/orders”
and returns the order confirmation:
{“id”:“a1fc03cb-bfe5-4b49-a5b3-002b73363215”,“client_order_id”:“0e0bc9d6-bcee-4eb1-ad87-68ea782754ee”,“created_at”:“2022-09-13T14:35:14.314459208Z”,“updated_at”:“2022-09-13T14:35:14.314517458Z”,“submitted_at”:“2022-09-13T14:35:14.313371839Z”,“filled_at”:null,“expired_at”:null,“canceled_at”:null,“failed_at”:null,“replaced_at”:null,“replaced_by”:null,“replaces”:null,“asset_id”:“b0b6dd9d-8b9b-48a9-ba46-b9d54906e415”,“symbol”:“AAPL”,“asset_class”:“us_equity”,“notional”:null,“qty”:“1”,“filled_qty”:“0”,“filled_avg_price”:null,“order_class”:“”,“order_type”:“market”,“type”:“market”,“side”:“buy”,“time_in_force”:“gtc”,“limit_price”:null,“stop_price”:null,“status”:“pending_new”,“extended_hours”:false,“legs”:null,“trail_percent”:null,“trail_price”:null,“hwm”:null,“subtag”:null,“source”:null}
This is a Windows idiosyncrasy and has nothing to do with curl per se. If you install a different version of curl not from MSFT, my best guess is that escaping doublequotes will still be required.
D:>curl -V
curl 7.83.1 (Windows) libcurl/7.83.1 Schannel
Release-Date: 2022-05-13
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS HSTS IPv6 Kerberos Largefile NTLM SPNEGO SSL SSPI UnixSockets