A dynamic DNS record is updated by a simple web request to the SwissCenter API. This is what compatible Internet boxes and NAS devices do; this article describes the request itself, so you can send it from a script or from a device that has no ready-made setting.
In short: send a POST or GET request over HTTPS to https://api.swisscenter.com/webservices.php/nic/update with host, username, password and, optionally, ip (the dynamic DNS credentials, not those of Apanel). The API answers good, nochg, nohost or badauth.
Prerequisites
What you need to know before you start
- The credentials to use are the ones you defined for this dynamic DNS in the Add dynamic DNS window, not those of your Apanel console. Never use your account password here.
- The password travels in the request address: always send it over HTTPS and do not share this address.
How do I send the update request?
Perform a POST request (GET is also accepted) to the following address:
https://api.swisscenter.com/webservices.php/nic/update
The API requires the HTTPS protocol. Here is an example request:
https://api.swisscenter.com/webservices.php/nic/update?host=__HOSTNAME__&ip=__MYIP__&username=__USERNAME__&password=__PASSWORD__
Replace the example values with your own:
host: the full hostname of the dynamic DNS (for example maison.votresite.ch);
username and password: the username and password of this dynamic DNS;
ip: the address to publish. This parameter is optional: without it, the API publishes the IP address the request comes from.
The API chooses the record type from the address itself: A for an IPv4 address, AAAA for an IPv6 address.
What does the API response mean?
The API answers with a single word:
| Response |
Meaning |
good |
The address has been updated. |
nochg |
The published address is already this one: nothing changed. |
nohost |
No dynamic DNS matches this hostname with these credentials. |
badauth |
A parameter is missing or invalid (username, hostname or IP address). |
If something goes wrong
nohost: check that host contains the full hostname and that the username and password are those of the dynamic DNS. If in doubt, change the dynamic DNS password in the Apanel console and copy it into your request.
badauth: one of the four parameters is empty or malformed. Check the spelling of the parameters, and the IP address if you specify it.
good but the name still answers with the old address: resolvers keep the old answer in cache until its TTL expires; wait, then check in the DNS change history that the update was received.
Going further