I am in the process of doing the same thing. The end solution will be triggered from a request in Service Now, remove the server, close the Service Now request.
My approach is the same, REST call to get the id, REST call to remove computer.
Maybe not the best way to do it but it works. This is not the exact code… But should work.
var pos1 = Response_From_Rest_Call.indexOf(“Answer type=“integer”", 0);
var pos2 = Response_From_Rest_Call.indexOf("”, pos1 + 2);
var BigFix_id = Response_From_Rest_Call.substring(pos1 + 23, pos2);
I would be interested if there is a better way to do it.