What is the correct way to delete a node from Solarwinds Orion using Rest API (not SWIS)?

I'm trying to programmatically delete a node from our SolarWinds Orion environment as part of our server decommission process I am automating.  I can't seem to find the correct endpoint to target in my POST to the API to do this, and I've searched the scheme documentation for our version (2024.1).  I should note I have no issues getting the NodeID from the API - it's just the delete operation I cannot figure out...

Here's what I am currently trying to do, but it fails:

# Extract the NodeID and perform the DELETE operation
if ($response.results.Count -gt 0) {
    $nodeID = $response.results[0].NodeID
    Write-Host "Node ID: $nodeID"

    # Construct the DELETE URI using NodeID
    $deleteUri = "$baseUri/Invoke/Orion.Nodes/Delete"

    $body = @{
        NodeID = $nodeID
    }

    $deleteResponse = Invoke-RestMethod -Uri $deleteUri -Method Post -Headers $headers -Body ($body | ConvertTo-Json) -ContentType "application/json" -SkipCertificateCheck

And here's the error I get:

- Deleting Server01 from SolarWinds Orion: Node ID: 8296
Invoke-RestMethod: .\windows_server_decomm.ps1:475
Line |
 475 |  … eResponse = Invoke-RestMethod -Uri $deleteUri -Method Post -Headers $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     |  {   "Message": "Verb Orion.Nodes.Delete: Not found",   "ExceptionType":
     | "SolarWinds.InformationService.Verb.VerbExecutorException",   "FullException":
     | "SolarWinds.InformationService.Verb.VerbExecutorException: Verb Orion.Nodes.Delete: Not found\r\n   at
     | SolarWinds.InformationService.Core.InformationService.Invoke[T](String entity, String verb, Action\u00601
     | setupParameters, Func\u00602 extractReturnValue)" }

Parents Reply Children
  • Yes we have the same automation for retiring servers. Most of the time someone will unmanage the nodes to keep them from alerting when they get shut down. The automation to delete the node runs days later. If the node is unmanaged the automation fails with an error similar to 'can't perform action' when we looked into it only the unmanaged ones were failing. We put in an extra line to re-manage it then delete it and the script has run fine ever since.