Page 1 of 1

Feature request for Dynamic DNS REST API

Posted: Thu Apr 30, 2015 8:26 am
by dherr
I just noticed that the TTLs reset to 7200 on the "A" records that I updated via the Dynamic DNS REST API tool.

https://public-api.sonic.net/dyndns/

Obviously you don't want a long TTL for a host that is dynamic. I can live with 7200 but I was trying for 1800, which does not seem excessively low. I did try to at &ttl=1800. It took it without giving an error but it did not set the TTL.

So, not to seem ungrateful for the great tool, I really do love it and will use it as is; but it would be great to add a switch to set our own TTL, or to simply not revert the TTL during updates. If we can't get it then I just have to make sure to go in and lower my TTLs after each dyn dns update (That is a reminder for others that might use this tool.)

P.S. Also noted that the zone SOA does not increment when using the API. The Sonic name servers do pick up the changes so I don't see that as an issue; just something that would make it more "clean" if added.

Re: Feature request for Dynamic DNS REST API

Posted: Fri May 01, 2015 3:37 pm
by kgc
PUT /dyndns/host should take an optional TTL variable now. Let us know how it works.

Re: Feature request for Dynamic DNS REST API

Posted: Fri May 01, 2015 3:55 pm
by dherr
Hey. Thanks much for playing with this...

Maybe I'm doing something wrong here. I have tried it like so:

curl -sX PUT --data "userid=12345&apikey=redacted&hostname=test.wombatz.com&TTL=600&value=127.0.0.4&type=A" https://public-api.sonic.net/dyndns/host

And tried it at the end:

curl -sX PUT --data "userid=12345&apikey=redacted&hostname=test.wombatz.com&value=127.0.0.4&type=A&ttl=600" https://public-api.sonic.net/dyndns/host

Both will work to update the IP value but it is still resetting the TTL to the 7200 default. I did just use the members tool to set it to 600 to make sure it would allow the rather low TTL, worked fine so I set it back to 7200.

Re: Feature request for Dynamic DNS REST API

Posted: Sun May 03, 2015 7:50 am
by dherr
Just in case nobody has noticed; the api thingy got wonky are around the same time as this TTL option was worked on. No clue if that is related of course, but it has been going up and down all weekend, as seen with:

7:17-doug@wombat-~/bin>curl -sX GET https://public-api.sonic.net/dyndns/ip <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>503 Service Temporarily Unavailable</title>
</head><body>
<h1>Service Temporarily Unavailable</h1>
<p>The server is temporarily unable to service your
request due to maintenance downtime or capacity
problems. Please try again later.</p>
<hr>
<address>Apache/2.2.15 (Scientific Linux) Server at public-api.sonic.net Port 443</address>
</body></html>

Re: Feature request for Dynamic DNS REST API

Posted: Tue May 05, 2015 12:48 pm
by kgc
Needs more monitoring! The apache->hypnotoad proxy seems to run into problems when hypnotoad is restarted.

Meanwhile, I fixed the TTL feature and made a few other changes to the api to make things a little easier. The type and value are optional now and will default to A and the IP of the connecting host and userid is returned when listing keys

Re: Feature request for Dynamic DNS REST API

Posted: Tue May 05, 2015 1:19 pm
by dherr
Wow. You took a simple feature request and took it 3 steps farther. My testing shows it working perfectly. A good tool is now a great tool. Thanks much!

Re: Feature request for Dynamic DNS REST API

Posted: Mon Feb 08, 2021 6:31 pm
by tquiggle
kgc,

Is there any reason not to just write a stateless update daemon to periodically PUT to

https://public-api.sonic.net/dyndns/host

with the hostname in an A record and update it to the current DHCP assignment, regardless of whether it has changed?

If it meaningfully reduces the load on your DNS infrastructure, I can always store the last assignment locally and only PUT when it changes, but hey, laziness is a virtue.

Tom