

Tesla Model S REST API - davidbarker
http://docs.timdorr.apiary.io

======
zachrose

      GET /vehicles/{id}/command/honk_horn
    
      Honk the horn once.
    

HTTP aficionados, should this be a POST of a honk resource?

~~~
Aqueous
I think it should probably be PUT or PATCH. POST is usually used to create a
resource; PUT/PATCH is used to update, even if that update has an expiration
(i.e. the horn stops honking.)

~~~
euphemize
PUT is idempotent, and also used to create new resources. I would use that
rather than POST. [1][2]

[1]
[http://stackoverflow.com/a/630475/443363](http://stackoverflow.com/a/630475/443363)

[2]
[http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html)

~~~
zachrose
I'm curious how idempotence figures into something like this. If you make the
same request twice, the horn should honk twice.

~~~
TheCoelacanth
> If you make the same request twice, the horn should honk twice.

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.

------
daliwali
This more closely resembles a RPC (Remote Procedure Call) API, rather than
adhering to REST principles. For example, making GET requests should only
retrieve data and not mutate state, whereas in this API, there's GET requests
to honk the horn, unlock and lock doors, setting AC temperature, etc. Query
parameters in the URL are also misused to pass information to be saved on the
server.

Stop labelling every API that operates over HTTP as a REST API, this one
clearly isn't.

------
spullara
This has been around for a long time. I've been tracking all the data
accessible in the REST API since I got my car in February of last year.

[https://github.com/spullara/teslalogger](https://github.com/spullara/teslalogger)

------
qhoc
Does anyone know or have a workable app using Tesla API? Or is it pretty much
documentation at this point? Because I have seen various versions of the doc
all over the internet.

~~~
sahaskatta
My app: [http://glasstesla.com](http://glasstesla.com)

~~~
qhoc
Don't mean to insult but is it "working"?

~~~
sahaskatta
Of course, 300+ people using regularly!

------
stephenitis
Are there optional parameters with these endpoints?

