Delete Host Folder ​
DELETE /winapi/hostfolders
Deleting a Host Folder is possible by submitting a 'DELETE' HTTP Verb to the API. When a Host Folder is deleted, you will be returned a Http Status Code of 204 - NoContent. No host records will be deleted from Passwordstate, if they were nested underneath the Folder being deleted.
The user executing the API script must be given access to the following:
- On the screen Administration -> Feature Access -> Hosts tab : 'Specify which users are allowed to have access to the main Hosts Menu'
- On the screen Administration -> Feature Access -> Hosts tab : 'Specify which users are allowed to add/edit/delete Folders within the Hosts Menu, as well as manage permissions on these Folders'
- The user must also have access to the Host Folder itself
Powershell
# Delete using FolderName
$Body = @{
FolderName = "Microsoft Database Servers"
}
$jsonData = $Body | ConvertTo-Json
# Delete using FolderID
#JSON data for the object
$Body = @{
FolderID = "12345"
}
$jsonData = $Body | ConvertTo-Json
# Delete using FolderName and SiteID
$Body = @{
FolderName = "Microsoft Database Servers"
SiteID = "7"
}
$jsonData = $Body | ConvertTo-Json
$PasswordstateURL = 'https://passwordstate/winapi/hostfolders/'
Invoke-Restmethod -Method Delete -Uri $PasswordstateURL -ContentType "application/json" -Body $jsonData -UseDefaultCredentialsJson
# Response
HTTP/1.1 204 No Content