The Domain Hoster InterNetworX (abbr. inwx) offers an XML-RPC interface to access its services. You can even register new domains. Documentation of the XML-RPC API is available for download at https://www.inwx.de/de/download/file/api-current.zip (including examples in PHP & Java plus a PDF describing the API).
There is an operational test environment (ote) to learn and test how to use the API without paying for your orders at https://api.ote.domrobot.com. You need a separate test-account to use it and you can get it on http://ote2.inwx.de.
The available objects to query and modify via XMLRPC can be found on https://github.com/pklaus/python-inwx-xmlrpc/wiki/Available-Objects and here is the overview:
contact– The handles for your Domain such as registrant, admin-c etc.
domain– Your domains
nameserver– The nameserver entries (as served by InterNetworX)
nameserverset– Sets of nameservers that you can assign to your domains 'en bloc'.
accounting- Check your balance, list and download invoices etc.
host– This object represents so-called glue records
message– Don't know about this one...
application– Don't know about this one...
Access the API via Python using python-inwx-xmlrpc
To leverage the use of the XML-RPC via Python, I wrote a Python class:
inwx and published it under the GPL license on Github: https://github.com/pklaus/python-inwx-xmlrpc. The class inwx from the module inwx is what you want to use. It largely simplifies the code needed to communicate with the InterNetworX API. What it does is to create a domrobot class from the module inwx for every object you try to access on the XML-RPC API. This is needed as the API exposes its services in the form https://api.domrobot.com/xmlrpc/object/call and not using normal "nested" call methods with dot syntax (e.g. examples.getStateName). Internally, the domrobot class is built by deriving a subclass of xmlrpclib.ServerProxy and reimplementing serveral of its methods.
The module is very elegant as it makes use some magic to bind XML-RPC methods to the inwx object without naming them explicitly (taken from the Python module xmlrpclib.py itself). In addition the inwx module is an example of well done object-oriented inheritance.
The Readme should be your next resource for help. Please post your comments here if you have any questions or contribute to the project if you have good ideas!
Using the API with the inwx class is really simple:
from inwx import inwx inwx_conn = domrobot("https://api.domrobot.com/xmlrpc/", username, password) # Request the list of all domains belonging to your account: print inwx_conn.nameserver.list() # List your invoices: print inwx_conn.accounting.listInvoices() # you can pretty print the output like this: import json print json.dumps(inwx_conn.nameserver.list(), indent=2) # or more human readable like this: from inwx import prettyprint print prettyprint.domains(inwx_conn.nameserver.list()['domains'])
Usage examples included in the project are:
example.backup-nameserver-entries.py– To back up all nameserver entries for all your domains.
example.create-contact.py– List previous and create a new contact handle.
example.download-all-invoices.py– Download invoices (only ones you haven't got yet & to a configurable folder).
example.dyndns.py– Realize a DynDNS-like service using the API (doesn't work that well: The minimum TTL is 3600 seconds = 1 hour).
example.list-domains.py– List all domains belonging to your account.
- `example.list-nameserversets.py – Print all the nameserver sets for your account.
example.register-domain.py– Enables you to order a new domain from the command line (does not include logic for extended requirements needed for special TLDs...)
DynDNS like service:
My code has been inspired by Christian Blechert's work. He has published a way to use the API in a Bash script to have regular DNS updates (like a DynDNS service). The bash script is called
updatedomain.sh and is useful on devices such as routers (running open source firmware).
I republished the script in a gist on Github.
The XML file
updatedata.xml must hold the account credentials for the customer area of inwx.de as well as the Unique ID of the DNS entry (subdomain). You can get the UID when changing the value of a dns entry. With the new user interface this is not as easy to find out any more... With the old inwx website this site used to be something like https://www.inwx.de/kunden/nameserver-updrec.php?recid=107779999.
Off course, you can get the IDs via the API but I didn't work on this for the Bash script. My Python class supports this, however.
- The InterNetworX website: https://www.inwx.de
- The API documentation: https://www.inwx.de/de/download/file/api-current.zip
- The Python module python-inwx-xmlrpc: https://github.com/pklaus/python-inwx-xmlrpc
- Christian Blechert's Bash script for the API: http://anwendungsentwickler.ws/dyndns_mit_der_inwx_xml-rpc_api/entry/313/
- The commercial XHMCS system (a CRM, billing and support system) http://www.whmcs.com/ can also use the API of InterNetworX: http://www.whmcs-germany.com/Thread-InterNetworX