Remove Host Records from Folder ​
DELETE /api/hostsinfolders
Removing a Host record from beneath a Host Folder is possible by submitting a 'DELETE' HTTP Verb to the API. When the Host record is removed, you will be returned a Http Status Code of 204 - NoContent. No host records are deleted here, instead they are removed from the Hosts Folder view in the UI.
Powershell
# Remove using HostName
$Body = @{
HostName = "webserver01.domain.net"
DeleteFromFolderID = "4490"
}
$jsonData = $Body | ConvertTo-Json
$PasswordstateURL = 'https://passwordstate/api/hostsinfolders/'
Invoke-Restmethod -Method Delete -Uri $PasswordstateURL -ContentType "application/json" -Body $jsonData -Header @{ "APIKey" = "<apikey>" }Json
# Response
HTTP/1.1 204 No Content