Hacker News new | ask | show | jobs
by stanleydrew 5904 days ago
Well yes technically the API does "work." The problem is that most people are coming from rails land (which is also where I'm from, btw) and over there, they have implemented "REST" as POST=create and PUT=update. This doesn't even really make sense in rails actually.

For a proper PUT request you have to specify the full body of the resource to be "put." It literally is supposed to be telling the server, "hey, put this thing I'm giving you at this url." For that to work you have to actually be delivering the thing, and in rails with PUT you are just submitting form data, which is a set of paramater name/value pairs (this is also what's going on with POST but in that case it's ok). This mistake derives mostly from the fact that rails works off of forms, and form data is always passed in parameter pairs, so you are never passing a full resource to the server. I'm still not sure why they don't just do create and update with POST though.

Anyway yes, your API will work fine. You can define it any way you want, and you don't even have to stick to the original intention of the HTTP verbs. It's just that to me, create should be idempotent in the case of creating zones and records, so why not use the idempotent http verb?

I highly recommend this: http://jcalcote.wordpress.com/2008/10/16/put-or-post-the-res... and this: http://www.elharo.com/blog/software-development/web-developm...