Public/Curanet/DNS/Remove-CuranetDNSRecord.ps1

function Remove-CuranetDNSRecord {
    <#
        .SYNOPSIS
            Command to remove a DNS record with a given ID
 
        .PARAMETER DomainName
            String containing domainname
 
        .PARAMETER ID
            Integer containing the ID of the record needed to be removed.
 
        .OUTPUTS
           $true on success, $false on error
    #>


    [CmdletBinding()]
    param (
        [Parameter(Mandatory)]
        [string]
        $DomainName,

        [Parameter(Mandatory)]
        [int]
        $ID
    )

    $Existing = Get-CuranetDNSRecords -DomainName $DomainName | Where-Object id -eq $ID

    if ( $Existing ) {

        $result = Invoke-CuranetAPI 3370 -Uri "https://api.curanet.dk/dns/v2/Domains/$($DomainName)/Records/$($ID)" -Method "DELETE"

        if($result) {
            return $true
        }

        else {
            return $false
        }
    }

    return $false
}