API & Powershell delete a specific agent

Trying to accomplish this.
I have a hostname in a powershell variable. I need to search the Asset through API and get it deleted.
Anyone has done this before?
I’m new to API and struggeling hard passing the search parameters.

(Invoke-RestMethod -Uri “$Rapid7_BaseUrl/assets?size=10000” -Headers $Rapid7_Headers).resources | select-object hostname

This brings me a list of all assets, but hard to get on from here. Should i instead use the search?
(Invoke-RestMethod -Uri “$Rapid7_BaseUrl/assets/search” -Headers $Rapid7_Headers).resources

But how do i specify the hostname in the API request?