[Pdns-dev] REST Backend preview
John Leach
john at brightbox.co.uk
Thu Feb 2 21:19:41 CET 2012
Hi Erik,
On 02/02/12 18:37, Erik Muttersbach wrote:
> I have finished a very first version of the REST backend and added it to
> a repository: https://github.com/erikmuttersbach/PowerDNS-REST-Backend
>
>
>
> The list command is not yet implemented and I also have HTTPS support on
> my roadmap. Anyway, I am happy about feedback J
Sorry if you think I'm nitpicking, but the interface you've designed
isn't actually RESTful:
http://en.wikipedia.org/wiki/Representational_state_transfer#RESTful_web_services
In particular, you're making a POST request to make a read-only request.
A GET would be more appropriate here, if nothing else but to make it
easier for the web server (or an inline proxy) to cache requests for you.
You also send the accept header with "*/*" though you actually expect
and can only handle json.
I think a better interface would be something like:
for an ANY query:
http://powerdns.com/record/example.com
for specific queries:
http://powerdns.com/record/example.com/SOA
http://powerdns.com/record/example.com/A
http://powerdns.com/record/example.com/NS
And pass in the other request info as http headers, maybe:
X-Powerdns-Zone-Id
X-Powerdns-Remote-Ip
X-Powerdns-Local-Ip
Perhaps pass in the remote IP with the X-Forwarded-For header, which
seems kinda cute, though probably a bit wrong really.
Doesn't have to be restful of course. You could just leave it as it is
and rename the backend to just something like "http".
Also, you should handle multiple records in the response (I don't think
you do currently). This is especially important with ANY queries.
Hope that's useful.
John.
http://johnleach.co.uk | http://brightbox.com
More information about the Pdns-dev
mailing list