btaylor927

Registered
Jan 12, 2014
4
0
1
cPanel Access Level
Root Administrator
I'm trying to write a script which involves adding a DNS zone to our DNS cluster, but in trying to test the Add DNS zone functionality of the API via curl, I get told that I need to enter an IP despite doing so.

The exact I'm running is:

Code:
curl -u root:pwd https://foo.com:2087/xml-api/adddns?domain=bar.com&ip=xxx.xxx.xxx.xxx&template=standard&trueowner=root
Which gives:

Code:
<adddns>
  <result>
    <status>0</status>
    <statusmsg>Sorry, you must enter an ip.  Please try again.</statusmsg>
  </result>
</adddns>
Is there something obvious I'm missing?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
Hello :)

I was unable to reproduce this issue. Are you using a valid security token in the URL? For example, my test request looked like this:

Code:
https://1.2.3.4:2087/cpsess5542266702/xml-api/adddns?domain=cptesting.com&ip=1.2.3.4&template=standard&trueowner=root
Also, do you notice the same issue across multiple browsers?

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
I hadn't done, but I was assuming that using curl with the -u flag handled the security authentication?
That's correct. I just noticed that you were using "curl" in the example you provided. I tested again using curl this time, and it still worked as expected. Do you experience the same problem when using this method to add the zone directly via the command line instead of through your custom script?

Thank you.