This function updates a given DNS zone. It can add, edit, and remove many records in a single call. It also ensures that each record not removed will occupy the same number of lines after the edit as it did before the edit.
serial required | integer >= 0 The current serial number in the DNS zone’s SOA (Start of Authority) record. If this value does not match the zone’s current state, the request fails. Example: serial=202001010100 |
zone required | string The name of one of the user’s DNS zones. Example: zone=example.com |
add | Array of strings <json> The records to add to the zone. Each item must be a serialized JSON object that contains:
An A record. add='{"dname":"example", "ttl":14400, "record_type":"A", "data":["11.22.33.44"]}'A TXT record. add='{"dname":"example", "ttl":14400, "record_type":"TXT", "data":["string1", "string2"]}' |
edit | Array of strings <json> The records to edit in the zone. Each item must be a serialized JSON object that contains:
Example: edit='{"line_index": 9, "dname":"example", "ttl":14400, "record_type": "TXT", "data":["string1", "string2"]}' |
remove | Array of integers The line indexes of records to remove from the zone. Example: remove=22 |
object | |
object |
whmapi1 mass_edit_dns_zone zone='example.com' serial='202001010100' remove=23 add='{"dname":"example", "ttl":14400, "record_type":"A", "data":["11.22.33.44"]}'
{- "data": {
- "new_serial": 2021031903
}, - "metadata": {
- "command": "mass_edit_dns_zone",
- "reason": "OK",
- "result": 1,
- "version": 1
}
}