DNS.DeleteRecord
Skip to content
mnscript
StringResult DNS.DeleteRecord(Secret, string) 

Description ​

Deletes a record on a domain. See https://portal.civilnetworks.net/maxnet/domains for more information

Arguments ​

Secret - Your secret domain key ( see https://portal.civilnetworks.net/maxnet/domains )
string - The record id.

Returns ​

StringResult - A StringResult detailing the success or failure of the operation

Example ​

msc
using Console;
using System;
using Util;
using Secrets;
using DNS;

// Deletes the IP record on the provided domain
// You must obtain a domain key from the DNS service ( https://portal.civilnetworks.net/maxnet/domains )
function DeleteDomainIPRecord(string domainKey, string domainName) {
    DomainRecord ipRecord = DNS.LookupRecord(domainName, "IP");
    
    if (Util.IsNull(ipRecord)) {
        Console.WriteLine("Record does not exist");
        return;
    }
    
    Console.WriteLine("Deleting record...");
    
    // Delete the record
    string recordID = ipRecord.GetID();
    StringResult result = DNS.DeleteRecord(domainKey, recordID);
    
    if (result.GetResult()) {
        Console.WriteLine("Domain record deleted!");
    } else {
        Console.WriteLine("Error: "..result.GetString());
    }
}

Secret domainKeySecret = Secrets.GetSecret("my secret domain key");
string domainName = "example.com";
DeleteDomainIPRecord(domainKeySecret, domainName);