

Ask HN: Feedback on REST API for managing DNS - durana

I am working on a DNS service that can be managed with a simple REST API.  I am looking to get feedback on the API.  So if you would, please take a look at the API documentation and share your thoughts.  Any sort of feedback is welcome.<p>REST API documentation is at http://wiki.burningbay.com/dns/rest-api<p>I am currently doing a private beta of the service with a few friends, with the plan to do a public beta in the near future.  If anyone would like to use the service before the public beta, please e-mail me.<p>Thanks!
======
stanleydrew
The api looks cool. I'd like to test it out before the beta if you need more
people.

I have a question though. You've already described the exact format for all of
the record types. So why not implement record creation with PUT and have the
sender put the JSON for the record in the request body? You want idempotency
for record creation so why not use the idempotent HTTP verb?

~~~
durana
If I understand your comment correctly, I believe the API already works this
way, except instead of using PUT, it uses POST for creating new records and
zones. To create a record, a client would do a POST with the record to create
in JSON as the request body.

Is there some reason to use PUT over POST in this case? By my understanding,
POST is typically used to create new resources and PUT is used to updated
existing resources.

Also, I can see now that the doc is pretty unclear on how the API expects data
to be sent in a request's body. I'll be sure to fix that!

Thank you for your comment and yes I'm in need of more beta testers! Please
e-mail me. My e-mail address can be found under my HN account.

~~~
stanleydrew
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...](http://jcalcote.wordpress.com/2008/10/16/put-or-post-the-
rest-of-the-story/) and this: [http://www.elharo.com/blog/software-
development/web-developm...](http://www.elharo.com/blog/software-
development/web-development/2005/12/08/post-vs-put/)

------
durana
A link that you can click on...

<http://wiki.burningbay.com/dns/rest-api>

