I'm trying to interface with the RPC API via curl, and am always getting "Invalid command" returned in the status string back from cgminer. I have tried telnetting to the api (to avoid any problems with curl submitting headers, etc) and I get exactly the same thing. Normally I would expect it to be my fault and I'm just getting the syntax messed up, but perhaps someone pointing it out to me publicly may help other poor shlupps too in the same situation.
I try via curl:
curl -X POST -H "Accept: application/json" -H "Content-Type: application/json" -d '{"command":"summary"}' http://localhost:4028
And via telnet:
telnet localhost 4028
summary
And I get the same reply either way:
STATUS=E,When=1367429875,Code=14,Msg=Invalid command,Description=cgminer 3.1.0|
Any help pointing out my error(s) would be appreciated. I'm guessing curl isn't submitting a JSON valid request and thus cgminer responds in plain-text, otherwise it would reply in JSON. But then, shouldn't telnet work?
My cgminer launch string is "./cgminer --api-listen --api-allow W:127.0.0.1"