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.

Debugging JSON API Results

Discussion in 'cPanel Developers' started by mikelegg, Dec 21, 2010.

  1. mikelegg

    mikelegg Well-Known Member

    Joined:
    Mar 29, 2005
    Messages:
    330
    Likes Received:
    0
    Trophy Points:
    16
    I'm having my first crack at using the JSON API and I'm trying to use the dumpzone function.

    I've copied the example code from the documentation and just changed the url, username and hash.

    So basically I'm using curl to make this call - https://myserver.com:2087/json-api/dumpzone?domain=mydomain.com

    The result I'm getting is {"result":[{"status":0,"statusmsg":"Failed to retrieve zone:mydomain.com"}]}

    I've checked and the zone file is definitely there.

    Is there a way of getting more information regarding why the zone can't be retrieved?
     
  2. mikelegg

    mikelegg Well-Known Member

    Joined:
    Mar 29, 2005
    Messages:
    330
    Likes Received:
    0
    Trophy Points:
    16
    I've made the same call to all of my nameservers (2 DNS-Only and 1 Full cPanel) and it only works on the full cPanel server.

    Do dumpzone calls only work when made to full versions of cPanel?
     
    #2 mikelegg, Dec 21, 2010
    Last edited: Dec 21, 2010
  3. mikelegg

    mikelegg Well-Known Member

    Joined:
    Mar 29, 2005
    Messages:
    330
    Likes Received:
    0
    Trophy Points:
    16
  4. mikelegg

    mikelegg Well-Known Member

    Joined:
    Mar 29, 2005
    Messages:
    330
    Likes Received:
    0
    Trophy Points:
    16
    OK, let's approach this another way ...

    If I can retrieve and modify the zone files on a full cPanel server, is there an API call that I can make to force the updated zone information to replicate to the DNS-Only servers? (I can't see such a call in the documentation)
     
  5. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi Mike,

    So, if I understand correctly, you essentially want to perform WHM's "Synchronize DNS Records." Unfortunately, there is not an XML/JSON-API call for this. I would suggest creating a feature request in our Feature Request Forum area. As you've described, this would be the only method to remotely and programmatically use our API and update the records on a DNSONLY instance, and thus would be very useful.

    Best Regards,
    -David
     
  6. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    Until cPanel comes out with a method for this, you can use this workaround:

    Either POST data to https://server:2087/scripts/makesec?all_domains=1&sync_zones=all_zones

    or call /usr/local/cpanel/whostmgr with those variables from the command line.

    You can bring up the Synchronize DNS Zones page in WHM and check the source for the <form></form> area which they use to POST the data if you need clarification or confirmation of any variables.

    /scripts/$0 = /usr/local/cpanel/whostmgr $0
    /scripts2/$0 = /usr/local/cpanel/whostmgr2 $0
    etc
     
  7. mikelegg

    mikelegg Well-Known Member

    Joined:
    Mar 29, 2005
    Messages:
    330
    Likes Received:
    0
    Trophy Points:
    16
    Done http://forums.cpanel.net/f145/api-function-synchronize-dns-records-180951.html
     
  8. mikelegg

    mikelegg Well-Known Member

    Joined:
    Mar 29, 2005
    Messages:
    330
    Likes Received:
    0
    Trophy Points:
    16
    Thanks for the suggestion. For now, I'm going to just try rsync-ing the modified zone to the other DNS servers.
     
  9. mikelegg

    mikelegg Well-Known Member

    Joined:
    Mar 29, 2005
    Messages:
    330
    Likes Received:
    0
    Trophy Points:
    16
    I've just found out that when the editzonerecord function is called it automatically updates all servers in the cluster which is all I wanted to achieve.

    Cool!
     
Loading...

Share This Page