Uninstall agent via API

Uninstall agent via API

Hi.
I am  trying to build a script (powershell for now) to offboard the computer.
It will uninstall all agents from the device and will send API request to remove asset from inventory on each system.
So now I am stuck with Desktop Central ... I managed to authenticate with 2factor Auth and able to connect with Authorization key in header. But how do use "/api/1.3/som/computers/removecomputer" endpoint ?
It requires to have this body:
  1. {
  2. "resourceids": [
  3. 101
  4. ]
  5. }
How do I get "resourceid" of the current computer?

P.S.
I could use "/api/1.3/som/computers" endpoint and match "resource_name" field with hostname to get it, but it seems very inefficient... especially when this endpoint returns paginated data, with only 25 devices per page... so in my case with 1200+ devices I will have to iterate on 50+ pages to build array and do the matching.
There must be some kind of agent command to return resourceid of the computer...

                  New to ADSelfService Plus?