[Pdns-dev] REST Backend preview

Erik Muttersbach erik at muttersbach.net
Thu Feb 2 21:47:24 CET 2012


Hi John,

you've got very good points! Of course you are right, GET is more
appropriate and also your proposal for a more "RESTy" API looks quite good.
How would you design the URI for the list request?

Let's see the current state of the rest-backend as a proof of concept. There
is a log of stuff to do still. Especially encryption and authentication is
in my mind.

Erk

-----Original Message-----
From: pdns-dev-bounces at mailman.powerdns.com
[mailto:pdns-dev-bounces at mailman.powerdns.com] On Behalf Of John Leach
Sent: Donnerstag, 2. Februar 2012 21:20
To: pdns-dev at mailman.powerdns.com
Subject: Re: [Pdns-dev] REST Backend preview

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_ser
vices

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
_______________________________________________
Pdns-dev mailing list
Pdns-dev at mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-dev



More information about the Pdns-dev mailing list