3 ms·
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.
by Aqueous 12y ago
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.)
- deleted 12y ago[deleted]
- zachrose 12y agoDoesn't it depend on whether the resource is the horn that makes the sound or the sound itself?
- euphemize 12y agoPUT 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 12y agoI'm curious how idempotence figures into something like this. If you make the same request twice, the horn should honk twice.
- TheCoelacanth 12y ago> 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.