The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Unable to add DNS zone via API

Discussion in 'cPanel Developers' started by btaylor927, Jan 12, 2014.

  1. btaylor927

    btaylor927 Registered

    Joined:
    Jan 12, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    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?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,696
    Likes Received:
    656
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  3. btaylor927

    btaylor927 Registered

    Joined:
    Jan 12, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I hadn't done, but I was assuming that using curl with the -u flag handled the security authentication?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,696
    Likes Received:
    656
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page