Sonic.net Dynamic DNS REST API
Pinging the server
A simple ping request to let you know things are working.
GET, PUT, or POST will work for making this request.
- Request
- GET /dyndns/ping
- PUT /dyndns/ping
- POST /dyndns/ping
- Parameters
- None
{ "message":"PONG", "result":200 }CURL Example
# curl -X GET https://public-api.sonic.net/dyndns/ping {"message":"PONG","result":200}
Getting your ip address
This allows you to get your current public ip address.
Note this may not work correctly if you are behind a proxy.
- Request
- GET /dyndns/ip
- Parameters
- None
{ "ip":"127.0.0.1", }CURL Example
# curl -X GET https://public-api.sonic.net/dyndns/ip {"ip":"209.204.190.64"}
Updating or adding host records
Allows a user to either update an existing host record or add a new one.
- Request
- PUT /dyndns/host
Parameter | Description |
---|---|
userid |
Valid userid optained via api key request |
apikey |
Valid api key obtained via api key request |
hostname |
Hostname assciated with apikey to be updated |
type |
A, AAA or TXT [defaults to A] |
value |
Optional value to set the record to, must be a valid IPv4, IPv6 or TXT record as appropriate for the record type [defaults to connecting host IP address (A records only)]. Note TXT record support is naive and assumes only one TXT record exists for the host and is not suitable for use where other TXT records must exist for the given host. |
ttl |
Optional TTL. Integer between 1 and 1209600, defaults to 7200 |
{ "message":"OK", "result":200 }CURL FORM PUT Example
# curl -X PUT --data 'userid=12345&apikey=4d6fbf2f9ab0fa11697470918d37625851fc0c51&hostname=foo.example.com&value=209.204.190.64&type=A' https://public-api.sonic.net/dyndns/host {"message":"OK","result":200}CURL JSON PUT Example
# curl -X PUT -H "Content-Type: application/json" --data '{"userid":"12345","apikey":"4d6fbf2f9ab0fa11697470918d37625851fc0c51","hostname":"foo.example.com","value":"209.204.190.64","type":"A"}' https://public-api.sonic.net/dyndns/host {"message":"OK","result":200}
Requesting an api key
Allows a user to request an api key to use for specified hostname for making updates
Returns a json formated string with an apikey and userid for future requests.
- Request
- POST /dyndns/api_key
Parameter | Description |
---|---|
username |
Valid Sonic.net username |
password |
Valid Sonic.net password |
hostname |
Hostname that you want to update. Must belong to username |
{ "userid": "12345", "apikey": "4d6fbf2f9ab0fa11697470918d37625851fc0c51" }CURL Form POST Example
# curl -X POST --data 'username=notarealuser&password=notarealpassword&hostname=example.com' https://public-api.sonic.net/dyndns/api_key {"userid":"12345","apikey":"4d6fbf2f9ab0fa11697470918d37625851fc0c51","result":200,"message":"OK"}CURL JSON POST Example
# curl -X POST -H "Content-Type: application/json" --data '{"username":"notarealuser","password":"notarealpassword","hostname":"example.com"}' https://public-api.sonic.net/dyndns/api_key {"userid":"12345","apikey":"4d6fbf2f9ab0fa11697470918d37625851fc0c51","result":200,"message":"OK"}
List api keys
Allows a user to list all api keys they have in use.
- Request
- POST /dyndns/list_api_key
Parameter | Description |
---|---|
username |
Valid Sonic.net username |
password |
Valid Sonic.net password |
{ "data":{ "userid":"0", "example.com":{ "key":"00000" }, }, "message":"OK", "result":200 }CURL Form POST Example
# curl -X POST --data 'username=notarealuser&password=notarealpassword' https://public-api.sonic.net/dyndns/list_api_key {"data":{"example.com":{"key":"4d6fbf2f9ab0fa11697470918d37625851fc0c51"}},"message":"OK","result":"200"}CURL JSON POST Example
# curl -X POST -H "Content-Type: application/json" --data '{"username":"notarealuser","password":"notarealpassword"}' https://public-api.sonic.net/dyndns/list_api_key {"data":{"example.com":{"key":"4d6fbf2f9ab0fa11697470918d37625851fc0c51"}},"message":"OK","result":"200"}
Removing an api key
Allows a user to remove an api key they no longer wish to use.
- Request
- DELETE /dyndns/api_key
Parameter | Description |
---|---|
username |
Valid Sonic.net username |
password |
Valid Sonic.net password |
hostname |
Hostname for api key to delete |
apikey |
api key to delete |
{ "message":"OK", "result":200 }CURL Form DELETE Example
# curl -X DELETE --data 'username=notarealuser&password=notarealpassword&hostname=example.com&apikey=4d6fbf2f9ab0fa11697470918d37625851fc0c51' https://public-api.sonic.net/dyndns/api_key {"message":"OK","result":200}CURL JSON DELETE Example
# curl -X DELETE -H "Content-Type: application/json" --data '{"username":"notarealuser","password":"notarealpassword","hostname":"example.com","apikey":"4d6fbf2f9ab0fa11697470918d37625851fc0c51"}' https://public-api.sonic.net/dyndns/api_key {"message":"OK","result":200}