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

Description ​

Creates or updates 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 domain name.
string - The record name ( Leave blank to use the root domain name )
string - The record type ( IP, TXT, etc.. )
string - The record value
number - The record TTL ( Recommend 300 )

Returns ​

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

Example ​

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

// Creates or updates a domain record
// You must obtain a domain key from the DNS service ( https://portal.civilnetworks.net/maxnet/domains )

Secret domainKeySecret = Secrets.GetSecret("my secret domain key");
string domainName = "yourdomain.com";
string recordName = "www";
string recordType = "TXT";
string recordValue = "My domain value";

StringResult result = DNS.CreateRecord(domainKeySecret, domainName, recordName, recordType, recordValue, 300);

if (result.GetResult()) {
    Console.WriteLine("Domain record updated successfully!");
} else {
    Console.WriteLine("Error: "..result.GetString());
}