Search Host Folders ​
GET /userapi/hostfolders
Searching for Host Folders can be achieved via multiple criteria, as outlined by the fields below. You can search using just one field, or multiple to further narrow down the search results.
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'
- Search results will only return Host folders the user has access to
- FolderID
- FolderName
- Description
- TreePath
- SiteID
- SiteLocation
Powershell
# Search by Folder Name
$PasswordstateUrl = 'https://passwordstate/userapi/hostfolders/?FolderName=<value>'
# Search by Folder Name and TreePath
$PasswordstateUrl = 'https://passwordstate/userapi/hostfolders/?FolderName=<value>&TreePath=<value>'
# Searching by FolderID
$PasswordstateUrl = 'https://passwordstate/userapi/hostfolders/?FolderID=<value>'
# Search by SiteID
$PasswordstateUrl = 'https://passwordstate/userapi/hostfolders/?SiteID=<value>'
# Search by Site Location
$PasswordstateUrl = 'https://passwordstate/userapi/hostfolders/?SiteLocation=<value>'
# Search by Folder Name and Site Location
$PasswordstateUrl = 'https://passwordstate/userapi/hostfolders/?FolderName=<value>&SiteLocation=<value>'
Invoke-Restmethod -Method GET -Uri $PasswordstateUrl -Header @{ "UserID" = "<UserID>" ; "APIKey" = "<APIKey>" }Json
# Response
HTTP/1.1 200
[
{
"FolderID":12345,
"FolderName":"Microsoft Database Servers",
"TreePath":"\",
"PropagatePermissions":"False",
"Description":"All Microsoft database servers",
"HostNameMatch":"",
"TagMatch":"",
"HostType":"",
"OperatingSystems":"",
"DatabaseServerType":"SQL Server",
"SiteID":"0",
"SiteLocation":"Internal"
}
]