EditDNS Forum  

Go Back   EditDNS Forum > Free.EditDNS.net > Tutorials

Reply
 
Thread Tools Display Modes
  #1  
Old 04-07-2010, 04:55 AM
untraceablesmurf untraceablesmurf is offline
Senior Member
 
Join Date: Apr 2009
Location: uk
Posts: 150
untraceablesmurf is on a distinguished road
Default How to use the API

To use the API you must setup your API IP/Hostname & API Hash.
To do this go to "my profile" and at the bottom of the page you should see this


Now click "Generate New Hash" then input your "IP/Hostname" and click "Update API IP"
It should now look like this



Below are the variables you can currently use:
Code:
email= - the E-Mail address you registered on EditDNS.net
apihash= - your API Hash
domain= - Your domain name you wish to update/add/delete

addDomain=1 - Add a new domain (has optional fields see below)
(optional) defaultIP= - pre-fill in the www and root domain records to point at an IP
(optional) masterNS= - make the domain a slave domain

deleteDomain=1 - Delete domain

addRecord=1 - Add a new record (has Required and optional fields see below)
(required) record= - The record name you want to add
(required) type= - The type of record you want to add (i.e. A,MX,CNAME)
(required) data= - The IP/hostname for the record
(optional) ttl= - The time to live of the record
(optional) aux= - Priority/Aux (mostly used for MX records)

deleteRecord=1 - Delete the record (has Required fields see below)
(required) record= - The record name you want to delete
(required) type= - The type of record you want to delete
You access the API here https://www.editdns.net/api/api.php

Every command needs your "email", "apihash" and "domain" you want it to affect.
so the basic format for every command would be:
Code:
https://www.editdns.net/api/api.php?email=youremail@address&apihash=agd8jsa9hgh5dsad567dskiuj87jy5d5&domain=example.com
Now for some examples showing how to add it all together.
I'll use "example.com" as the domain we want to change/add/delete

Add a new domain (regular domain)
we just add "&addDomain=1" to the basic command
Code:
https://www.editdns.net/api/api.php?email=youremail@address&apihash=agd8jsa9hgh5dsad567dskiuj87jy5d5&domain=example.com&addDomain=1
Add a new domain (regular domain with IP pre-filled)
we just add "&addDomain=1&defaultIP=123.456.123.456" to the basic command
Code:
https://www.editdns.net/api/api.php?email=youremail@address&apihash=agd8jsa9hgh5dsad567dskiuj87jy5d5&domain=example.com&addDomain=1&defaultIP=123.456.123.456
Add a new domain (backup/slave domain)
we just add "&addDomain=1&masterNS=123.456.789.123" to the basic command
Code:
https://www.editdns.net/api/api.php?email=youremail@address&apihash=agd8jsa9hgh5dsad567dskiuj87jy5d5&domain=example.com&addDomain=1&masterNS=123.456.789.123
Delete a domain
we just add "&deleteDomain=1" to the basic command
Code:
https://www.editdns.net/api/api.php?email=youremail@address&apihash=agd8jsa9hgh5dsad567dskiuj87jy5d5&domain=example.com&deleteDomain=1
Add a new record (A record)
we just add "&addRecord=1&record=test.example.com&type=A&data= 123.456.123.789" to the basic command
Code:
https://www.editdns.net/api/api.php?email=youremail@address&apihash=agd8jsa9hgh5dsad567dskiuj87jy5d5&domain=example.com&addRecord=1&record=test.example.com&type=A&data=123.456.123.789
Add a new record with a different ttl (A record with ttl of 1 hour)
we just add "&addRecord=1&record=test.example.com&type=A&data= 123.456.123.789&ttl=3600" to the basic command
Code:
https://www.editdns.net/api/api.php?email=youremail@address&apihash=agd8jsa9hgh5dsad567dskiuj87jy5d5&domain=example.com&addRecord=1&record=test.example.com&type=A&data=123.456.123.789&ttl=3600
Add a new record (CNAME record)
we just add "&addRecord=1&record=test2.example.com&type=CNAME& data=www.example.com" to the basic command
Code:
https://www.editdns.net/api/api.php?email=youremail@address&apihash=agd8jsa9hgh5dsad567dskiuj87jy5d5&domain=example.com&addRecord=1&record=test2.example.com&type=CNAME&data=www.example.com
Add a new record (MX record)
we just add "&addRecord=1&record=example.com&type=MX&data=mail .example.com&aux=5" to the basic command
Code:
https://www.editdns.net/api/api.php?email=youremail@address&apihash=agd8jsa9hgh5dsad567dskiuj87jy5d5&domain=example.com&addRecord=1&record=example.com&type=MX&data=mail.example.com&aux=5
Add a new record (NS record)
we just add "&addRecord=1&record=example.com&type=NS&data=ns3. eu.editdns.net" to the basic command
Code:
https://www.editdns.net/api/api.php?email=youremail@address&apihash=agd8jsa9hgh5dsad567dskiuj87jy5d5&domain=example.com&addRecord=1&record=example.com&type=NS&data=ns3.eu.editdns.net
Delete a record (A record)
we just add "&deleteRecord=1&record=test.example.com&type= A" to the basic command
Code:
https://www.editdns.net/api/api.php?email=youremail@address&apihash=agd8jsa9hgh5dsad567dskiuj87jy5d5&domain=example.com&deleteRecord=1&record=test.example.com&type=A
Delete a record (CNAME record)
we just add "&deleteRecord=1&record=test2.example.com&type=CNA ME" to the basic command
Code:
https://www.editdns.net/api/api.php?email=youremail@address&apihash=agd8jsa9hgh5dsad567dskiuj87jy5d5&domain=example.com&deleteRecord=1&record=test2.example.com&type=CNAME
Delete a record (MX record)will delete first MX record
we just add "&deleteRecord=1&record=example.com&type=MX" to the basic command
Code:
https://www.editdns.net/api/api.php?email=youremail@address&apihash=agd8jsa9hgh5dsad567dskiuj87jy5d5&domain=example.com&deleteRecord=1&record=example.com&type=MX
Delete a record (NS record)will delete first NS record
we just add "&deleteRecord=1&record=example.com&type=NS" to the basic command
Code:
https://www.editdns.net/api/api.php?email=youremail@address&apihash=agd8jsa9hgh5dsad567dskiuj87jy5d5&domain=example.com&deleteRecord=1&record=example.com&type=NS
Now you know how to format the commands you can create custom script's that will automate the process for you. (example - i use a control panel for web-hosting, it automatically adds/deletes the domain to editdns when i add/delete it to the webserver.)

Hopefully this helps somebody, i'll update if/when any new commands are available.
If i've missed any please let me know.

untraceablesmurf

Last edited by untraceablesmurf; 06-04-2010 at 12:46 PM.
Reply With Quote
  #2  
Old 04-13-2010, 03:12 PM
tyler tyler is offline
Nerdie Networks Staff
 
Join Date: Feb 2007
Posts: 1,538
tyler has disabled reputation
Default

Awesome tutorial!

Thank you!
__________________
- Tyler
Thank you for using our network. We truly appreciate your business.
Reply With Quote
  #3  
Old 06-04-2010, 07:21 AM
JonathanS JonathanS is offline
Junior Member
 
Join Date: Jun 2010
Posts: 2
JonathanS is on a distinguished road
Default

Thanks, please can we modify DNS records

Also can you make the delete records let me delete a row (&data=) because at the moment it doesn't delete the correct NS.

So its like &deleteRecord=1&record=example.com&type=NS&data=ns 1.example.com
rather than &deleteRecord=1&record=example.com&type=NS

thanks
Reply With Quote
  #4  
Old 06-04-2010, 12:45 PM
untraceablesmurf untraceablesmurf is offline
Senior Member
 
Join Date: Apr 2009
Location: uk
Posts: 150
untraceablesmurf is on a distinguished road
Default

Quote:
Originally Posted by JonathanS View Post
Also can you make the delete records let me delete a row (&data=) because at the moment it doesn't delete the correct NS.
Very good point, when i tested everything i used a test domain so it only had one NS record. the same will be true for MX records as well.
hopefully editdns will be able to add the "&data=" function to those commands.
Reply With Quote
  #5  
Old 07-26-2010, 02:08 PM
odyniec odyniec is offline
Junior Member
 
Join Date: Mar 2009
Posts: 2
odyniec is on a distinguished road
Default Perl interface to the API

In case anyone would be interested in using the API from within a Perl script, I have developed a Perl module for this purpose. It's called WebService::EditDNS, and it's available at CPAN: http://search.cpan.org/~odyniec/WebS...ice/EditDNS.pm
__________________
odyniec
http://odyniec.net/
Reply With Quote
Reply

Tags
api, api help, api howto, api usage

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:24 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.