API - DNS - Add / modify multiple records

bouvrie

Active Member
Apr 6, 2012
36
6
58
cPanel Access Level
Root Administrator
Hi, I'm looking for a means of adding and/or modifying multiple DNS records for a single domain in one go, via a WHM API. Domains in the DNS have no relation to a WHM user.

When using multiple "editzonerecord" API calls, the SOA serial is +1'ed at every request and I have to juggle with line numbers when changing and removing multiple records in one go...

How can I achieve a DNS zone modification in a transaction of some sort?
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,749
2,205
363
cPanel Access Level
DataCenter Provider
Twitter
Hello,

We document how to use this WHM API 1 function at:

WHM API 1 Functions - editzonerecord - Developer Documentation - cPanel Documentation

Using the dumpzone function and line numbers is the most effective way to use this API function, as noted:

This function edits a DNS zone record. To effectively use this function, use the following workflow:
  1. Run the dumpzone function on the DNS zone record to edit.
  2. Locate the Line value that corresponds to the data to edit.
  3. Use the values from that zone record to formulate the appropriate editzonerecord parameters.
Otherwise, an alternative would be to manually modify the zone file directly via the command line (/var/named/$domain.tld.db) outside of the API.

Thank you.