Using the Panel API for A Record updates

software development

#1

Hey folks,

I’m a llittle curious about how to go about creating an app to automatically update an A Record on my DNS list.
It would in the same way the No-IP client works but solely to update a specific record only.

Getting the IP address is easy, but I am only able to work within the .Net Framework of Visual Basic.
Or would it be easier to work the API into a PHP script of some sort?

Thanks


#2

You might look here for a server side solution that’s already baked, then you just have to come up with way to make the required request from your local system: http://wiki.dreamhost.com/Dynamic_DNS

There are also a few API apps that have already been completed here : http://wiki.dreamhost.com/API_Apps#DNS


#3

Thanks for that LakeRat,

I’ve found an app on that page I think will already suite my needs, but I’ll need to get in touch with it’s developer as it needs a splash of updating.

Meanwhile, the DNS Manager listed is keeping me very happy thus far :slight_smile:


#4

Hi again :slight_smile:

The fella I tried to contact either hasn’t checked his mail, or wont respond.
So I have endeavoured to create my own from scratch but hit a few stumbling blocks.

So far I can retrieve data from the API using dns-list_records, and manipulate that data within my application (listviews etc…)
But I’m confused as to how you update/edit an editable record.
The api only shows list/add/remove… So how would one go about amending a record? -
by removing it first, or will add automatically update the record if it already exists?
(If you have to remove then re-add, would it not be worth suggesting an additional “update” function to the api?
Would make processing all that bit simpler :wink: )

And, will all and only custom DNS records have the editable “1” value? - I want to filter the dns-list_records result by custom entries only.

Also, on a side note, I have been thinking about how I can verify that a key exists / is valid for the use my application has for it.
What would you guys suggest I use to verify that the key has full DNS- access, or are you stuck trusting the user to have enabled it?
I ask only because I can test using dns-list_records, and it will succeed if it’s valid but how do you test for add/remove?

EDIT:
Probably a dumb question but I want to make sure anyway, when structuring the URL for the API, is this following a valid method?

(the api-key isn’t mine btw, it’s the example from the wiki but it only has list available to it, and I’m at work so I can’t test this rigght now)


#5

Remove the record you don’t want, and add the one you do want. Simple as that.

An “update” command is a bit tricky, as it’s actually possible to have multiple records for the same name. (For instance, try running “nslookup google.com” in a terminal — from most locations, you’ll end up with a whole slew of different IP addresses.) I definitely see the utility of such a command, though, and I’ll look into getting one added.

Correct. Records with editable=0 are ones which we created automatically, either because they’re structurally required (e.g, SOA and NS records on the root of a domain) or because you’ve got a service running on the domain which requires them (e.g, “www”, “ftp”, “mail” records).

You can get the list of valid API commands for a key using the api-list_accessible_cmds command:

Two unrelated but useful things to note here: First of all, the unique_id is optional, and we actually recommend that you skip it unless you need it to prevent commands from being re-executed. Secondly, we support a number of much nicer output formats than the default “tab” format, including json, xml, php, and perl. There’s also html, which isn’t really useful for machine consumption but is handy for hand testing and debugging.


#6

Many thanks for the reply Andrew,

I have changed the output to a more manageable XML format which I’ll get to testing a bit later.

The Unique_ID was precautionary, but as it’s not required, I will comment out the line in future as the
commands are scheduled rather than manually executed.

Now that I know you can have more than one record, I definitely understand why there wasn’t an update option,
and after a bit of thought I can see why it would be better to remove/add rather than just update.
But if we can work out a clean way of implementing it, I don’t see why not (each entry has a unique id exposed to the API?)

And thanks for the info on the api-list_accessible_cmds, I totally missed it.