appdotnet / api-spec

App.net API Documentation is on the web at https://developers.app.net. Source for these docs is in the new-docs branch here. Please use the issue tracker and submit pull requests! Help us build the real-time social service where users and developers come first, not advertisers.
https://developers.app.net
950 stars 98 forks source link

Idempotent operations (stars, reposts…) should be PUT instead of POST #320

Open valpackett opened 11 years ago

valpackett commented 11 years ago
PUT https://alpha-api.app.net/stream/0/posts/1/repost

makes much more sense than

POST https://alpha-api.app.net/stream/0/posts/1/repost

If the post is already reposted, you can't repost it more. Same with star, mute, follow. These actions are idempotent – you can't follow/star/repost/mute twice.

See We Don't Know HTTP for an in-depth explanation.

derelk commented 11 years ago

I suggest finding a textual and authoritative source. I think it's really unlikely that anyone is going to watch a 40-minute conference video to evaluate this issue.

mattflaschen commented 11 years ago

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

Though this seems to come up a lot (better adherence to HTTP best practices). Correct me if I'm wrong, but I haven't seen app.net actually make a change for such a reason yet. Presumably they are considering simplicity (no duplicate methods) and backwards-compatibility.