dyndns gives me Unauthorized

Advanced feature discussion, beta programs and unsupported "Labs" features.
8 posts Page 1 of 1
by pathma » Fri Dec 08, 2017 12:54 am
curl -X POST -H "Content-Type: application/json" --data '{"username":"XXXX","password":"YYYY"}' https://public-api.sonic.net/dyndns/list_api_key

returns the expected:
{"message":"Not Found : the information you requested was not found.","result":"404"}

But
curl -X POST -H "Content-Type: application/json" --data '{"username":"XXXX","password":"YYYY","hostname":"ZZZZ.com"}' https://public-api.sonic.net/dyndns/api_key

returns

{"result":401,"message":"Unauthorized : you are not authorized to access this information."}

Am assuming from this that its not a credential issue with my XXXX/YYYY as when I intentionally
put the wrong password for list_api_key I get unauthorzied. So for api_key I guess it doesn't think I own the hostname. I have registered the domain name, but how does the API figure out if I own it or not?

Thanks, I am just trying to get this to work as I lost my static IP after the Fusion to FTTN upgrade

Pathma
by dherr » Fri Dec 08, 2017 7:33 am
Looking at my notes from when I did this and at the Sonic instructions.

Their notes:
https://public-api.sonic.net/dyndns

Looks like you correctly used the "CURL JSON POST Example" form.

Have you tried the "CURL Form POST Example" format?

My notes show that I used the "Form" version and it did work for me.

The other consideration is if you have more than one Sonic user/pass connected to your account. Oh, and what if you have a special character in your password that just happens to break this? Maybe do a temp change of pass to see what happens. Just remember things like e-mail breakage while you have the temp password running.
by drew.phillips » Fri Dec 08, 2017 10:46 am
Hi Pathma,

I tried with some of my accounts that do and don't have dynamic DNS services and realized the following behavior.

list_api_keys will return a 404 if your credentials are valid but you have no API keys. It will also return a 401 if you use the wrong credentials.

Requesting an api key will fail with a 401 if your credentials are valid but you do not have DNS services for the domain you're requesting the key for. It will also return a 401 if your password is incorrect.

Hope that helps!
Drew Phillips
Programmer / System Operations, Sonic.net
by pathma » Fri Dec 08, 2017 4:30 pm
Hi Drew

Thanks for the reply. I feel the creds are ok, as I get the expected unauthorized error if I give the
wrong password. But you mention that maybe I do not have a DNS service. Could you explain
that a bit more? I used to have a static IP with Fusion, but I never had to use Sonic's DNS previously.
My domain name is hosted by some other company, could that be the reason?

Thanks for your help with this!
Pathma
by drew.phillips » Fri Dec 08, 2017 5:25 pm
Hi Pathma,

Not having your domain's DNS with Sonic would be the reason. This service gives you API access to modify the DNS records for any sites that you have registered to your Sonic account who's authoritative nameservers are pointed to Sonic's DNS.

It's not clearly stated on the public-api page that this Dynamic DNS service only gives you the ability to modify DNS for sites that have DNS hosting with Sonic. In that sense, it's not like a traditional "DynDNS" type service where we give you a free hostname that you can then ping when your IP changes.

If you have a site with DNS hosting at Sonic, you could set up a subdomain like home.mydomain.org which you would then periodically update using this service.

For $1.95/mo, you can host your site's DNS with Sonic by logging in to Member Tools and going to Web Sites / Domain Names => Hosting => Add Hosting. Then you would enter your domain name, choose DNS Only and then Add Hosting. Once your domain is pointed to our DNS servers (a, b, and c.auth-ns.sonic.net) you can use our DNS editor (and the Dynamic DNS API) to add and edit records for your domain.

You can add DNS without moving your web hosting as well. Simply edit your domain's A record to point to your current hosting IP (and make sure your MX records are set properly too!) and you can use our DNS with third party hosting.

I hope that clears up any confusion. Let me know if you have any other questions too.
Drew Phillips
Programmer / System Operations, Sonic.net
by pathma » Fri Dec 08, 2017 5:37 pm
Thanks Drew, that makes sense and answers my question on how Sonic might determine I am
an owner of a domain. I'll wait till the other expires and move to sonic, if sonic does domain
registration. If so is there a reference to costs etc. for that.

Regards
Pathma
by drew.phillips » Fri Dec 08, 2017 5:43 pm
We do indeed also do domain registration which you can find out more about here (pricing included).

If you don't want to wait for it to expire, you can even transfer it to us now. The transfer fee includes an additional year of registration as well and you can find the links to Member Tools to transfer your domain in the second link.
Drew Phillips
Programmer / System Operations, Sonic.net
by pathma » Fri Dec 08, 2017 8:06 pm
Thanks Drew, I'll check out the links!

Regards
Pathma
8 posts Page 1 of 1

Who is online

In total there are 30 users online :: 0 registered, 0 hidden and 30 guests (based on users active over the past 5 minutes)
Most users ever online was 999 on Mon May 10, 2021 1:02 am

Users browsing this forum: No registered users and 30 guests