Public/Curanet/DNS/Update-CuranetDNSRecord.ps1
function Update-CuranetDNSRecord { <# .SYNOPSIS Command to update an existing record. .PARAMETER DomainName String containing domainname .PARAMETER ID Integer containing the ID of the record needed to be changed. .PARAMETER Value String containing the new value .OUTPUTS $true on success, $false on error #> [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string] $DomainName, [Parameter(Mandatory=$true)] [int] $ID, [Parameter(Mandatory=$true)] [string] $Value ) $Existing = Get-CuranetDNSRecords -DomainName $DomainName | Where-Object id -eq $ID if ( $Existing ) { $Body = @{ name = $Existing.Name type = $Existing.Type ttl = $Existing.TTL priority = $Existing.Priority data = $Value } $result = Invoke-CuranetAPI "3370" -Uri "https://api.curanet.dk/dns/v2/Domains/$($DomainName)/Records/$($ID)" -Method "PUT" -Body $Body if($result) { return $true } else { return $false } } return $false } |