Tesla Model S REST API
docs.timdorr.apiary.io
docs.timdorr.apiary.io
GET /vehicles/{id}/command/honk_horn
Honk the horn once.
HTTP aficionados, should this be a POST of a honk resource?1) Honk is not a resource and using REST here makes no sense. When you want to send actions across network, RESTful HTTP is not as good of a technology as, say, Websockets. See http://blog.arungupta.me/2014/02/rest-vs-websocket-compariso...
2) If you must use RESTful HTTP, this would be a GET with an Authorization header that contains an authorization token. This solves the Google spider problem and, well, the fact that you don't want just anyone honking your horn! :)
Exactly. That means this request is not idempotent, so PUT shouldn't be used. Of GET, PUT, POST and DELETE, only POST is not supposed to be idempotent, so it would be the preferred method to use for this request.
There are a lot of state-changing commands there that are all GET. This API is definitely not REST (i.e. just because it uses HTTP, doesn't make it RESTful).
GET /vehicles/{id}/command/set_charge_limit?percent={limit_value}
Set the charge limit to a custom percentage. Set the charge limit to a custom percentage.
Should be:POST or UPDATE /vehicles/{id}/settings/charge_limit
Parameters: percent (int 0-100) Set the charge limit to a custom percentage.
replyGET definitely should not produce a honking sound. GET is meant to not have side-effects. If the response to the GET were, say, a URL which refers to a usable honk (that could then be POSTed to) then it might sort of make sense. But, no, producing sound is i/o. This is bad design.
Stop labelling every API that operates over HTTP as a REST API, this one clearly isn't.