News for hackers. Stuff that matters.
Re:Tesla Model S JSON API by pdonis on Sunday June 29, 2014 @09:28PM (#7963219)
POST doesn't have to create a resource; it can also be used to annotate existing resources.

The main problem with using PUT is that PUT is supposed to be idempotent; the result of two PUTs with the same content should be the same as the result of a single PUT with that content. But two PUTs to honk the horn would honk the horn twice, not once.

Since we're all being pedantic about HTTP methods here, we should have a link to RFC 2616 :)

http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

Re:Tesla Model S JSON API by noonespecial on Sunday June 29, 2014 @09:34PM (#7963242)
Ahh. Good point. I was considering PUTting the horn into the honking state vs POSTing horn honks for execution. In the first case, 2 PUT honks would just result in a honking car, in the second, 2 POSTs would get you 2 "honks" whatever those are defined to be.

I guess I was thinking of the idempotent "panic" button on my cars key fob.

Re:Tesla Model S JSON API by pdonis on Sunday June 29, 2014 @10:54PM (#7963462)
the idempotent "panic" button on my cars key fob

Hmmm, mine actually isn't--one hit turns panic mode on, the second turns it off.

Re:Tesla Model S JSON API by nl on Sunday June 29, 2014 @09:57PM (#7963304)
There's a reasonable argument for a custom verb.

But pragmatically, given the problems customs verbs cause I'd probably go for POST.

Re:Tesla Model S JSON API by daurnimator on Sunday June 29, 2014 @11:48PM (#7963613)