Rest API / PowerShell / Unmanage Nodes

Hi all,

I'm trying to write a PowerShell script that uses REST to connect to our Orion installation, and, in this instance, sets the node to unmanaged for 10 years (part of our decom process so really it can be indefinite).  I have been banging my head against the wall with this for almost a week.  Can someone please take a look below and see what I am doing wrong?  Many thanks!

# Combine username and password
$combined = "$($username):$($password)"

# Convert to Base64
$encodedCredentials = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($combined))

# Define the NetObjectID for the node
$netObjectId = "N:$nodeId"

# Define unmanage and remanage times
$unmanageTime = Get-Date  # Current time for unmanage start
$remanageTime = $unmanageTime.AddYears(10)  # Example: 10 years into the future

# Format times in ISO 8601
$unmanageTimeStr = $unmanageTime.ToString("yyyy-MM-ddTHH:mm:ss")
$remanageTimeStr = $remanageTime.ToString("yyyy-MM-ddTHH:mm:ss")

# Prepare the payload with all required parameters, including a boolean for child objects
$body = @{
    "netObjectId" = $netObjectId
    "unmanageTime" = $unmanageTimeStr
    "remanageTime" = $remanageTimeStr
    "includeChildObjects" = $true  # Assuming this is the fourth required parameter
} | ConvertTo-Json

# API endpoint for the unmanage action
$uri = "https://$orion/SolarWinds/InformationService/v3/Json/Invoke/Orion.Nodes/Unmanage"

# Header with encoded credentials
$headers = @{
    Authorization = "Basic $encodedCredentials"

# Make the API call
try {
    $response = Invoke-RestMethod -Uri $uri -Headers $headers -Method Post -ContentType "application/json" -Body $body -SkipCertificateCheck
    Write-Host "Node $nodeId has been successfully set to unmanage." -ForegroundColor Green
} catch {
    Write-Host "Failed to set node $nodeId to unmanage: $_" -ForegroundColor Red

Here's the error I'm getting:

Failed to set node 11976 to unmanage: 
  "Message": "Verb Orion.Nodes.Unmanage requires parameter \u0027isRelative\u0027 (#3) with type System.Boolean but none was found.",
  "ExceptionType": "SolarWinds.InformationService.Verb.VerbExecutorException",
  "FullException": "SolarWinds.InformationService.Verb.VerbExecutorException: Verb Orion.Nodes.Unmanage requires parameter \u0027isRelative\u0027 (#3) with type System.Boolean but none 
was found.\r\n   at SolarWinds.InformationService.Verb.VerbExecutorContext.\u003C\u003Ec__DisplayClass26_0.\u003CUnpackageParameters\u003Eg__GetParameterByIndex|0(Int32 index)\r\n   at 
SolarWinds.InformationService.Verb.VerbExecutorContext.CreateParameters(Func\u00602 getParameterAt, Int32 parametersCount, Stream stream)\r\n   at SolarWinds.InformationService.Verb.VerbExecutorContext.UnpackageParameters(JObject parameters)\r\n   at SolarWinds.InformationService.Core.InformationService.Invoke[T](String entity, String verb, Action\u00601 setupParameters, Func\u00602 extractReturnValue)"