So i've been digging through THWACK trying to find a solution for this... and I'm struggling to make these commands function.
#Get NodeID from SW
################################
curl -k -u sa-orionadmin:<pass> "https://ORION:17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT+NodeID+FROM+Orion.Nodes+WHERE+DNS='2016-TestVM.corp.footlocker.net'"
This command will return results in JSON format, like so:
{"results":[{"NodeID":2949}]}
Iddeally, I was hoping to return just the NodeID value. IE - "2949". So I can assign it to a variable to run the UnManage Node Curl command....
#UnManage Node from SW
################################
curl -k -u sa-orionadmin:<pass> -X POST -H "Content-Type: application/json" -d ["""N:2949""","""10-16-2019 12:00:00 AM""","""10-17-2019 12:00:00 AM""","""false"""] "https://ORION:17778/Solarwinds/InformationService/v3/json/Invoke/Orion.Nodes/Unmanage"
This command behaves like it's working by returning a value of simply "null". But the node status does not change at all. However I can run the Re-Manage command and that functions just fine...
#Re-Manage Command - Working
################################
curl -k -u sa-orionadmin:<pass> -H "Content-Type: application/json" -d ["""N:2949"""] https://ORION:17778/SolarWinds/InformationService/v3/Json/Invoke/Orion.Nodes/Remanage
To Summarize my questions.
1.)How can I use curl to return ONLY the NodeID?
2.) Why isn't my UnManage Curl command working?
I've attached a screenshot comparing the verbose output from the working Remanage command (left) and the not-working UnManage command (right). Best I can tell the outputs look identical and the UnManage command SHOULD be working...