Add Host Folder ​
POST /api/hostfolders
Adding a new Host Folder object can be achieved by making a POST request on the URL, with appropriate fields forming the HTTP message body. To create Host Folders, you must use the Hosts API Key.
The PowerShell example below creates a Host Folder record with various fields specified.
Powershell
#JSON data for the object
$Body = @{
HostName = "abcserver.halox.net"
NestUnderFolderID = "350"
}
$jsonData = $Body | ConvertTo-Json
$PasswordstateURL = 'https://passwordstate/api'
$result = Invoke-Restmethod -Method Post -Uri $PasswordstateURL'/hostfolders' -ContentType "application/json" -Body $jsonData -Header @{ "APIKey" = "<apikey>" }
Write-Output $resultJson
# Response
HTTP/1.1 200
[
{
"FolderID":"12345",
"FolderName":"Microsoft Database Servers",
"Description":"All Microsoft database servers",
"TreePath":"\",
"PropagatePermissions":"False",
"HostNameMatch":"",
"TagMatch":"",
"HostType":"All Host Types",
"OperatingSystems":"",
"DatabaseServerType":"SQL Server",
"SiteID":"0",
"SiteLocation":"Internal"
}
]