Adding a new Folder ​
POST /api/folders
Adding a new Folder object can be achieved by making a POST request on the URL, with appropriate fields forming the HTTP message body. To create Folders, you must use the System Wide API Key.
This method returns the new Folder object as described above. The newly created FolderID can then be used in further processing when adding Password Lists, to nest these new Password Lists beneath the newly created Folder.
powershell
# Powershell Request (POST)
#JSON data for the object
$Body = @{
FolderName = "Test Folder"
Description = "First API Folder"
CopyPermissionsFromPasswordListID = "4"
CopyPermissionsFromTemplateID = ""
PropagatePermissions = "True"
DisableInheritance = "False"
NestUnderFolderID = "0"
}
$jsonData = $Body | ConvertTo-Json
$PasswordstateUrl = 'https://passwordstate/api/folders'
$result = Invoke-Restmethod -Method Post -Uri $PasswordstateUrl -ContentType "application/json" -Body $jsonData -Header @{ "APIKey" = "<apikey>" }json
# Response
HTTP/1.1 200
[
{
"FolderID": 181,
"FolderName": "Northern Region Customers",
"Description": "Folder for all Northern Customer Password Lists",
"TreePath": "\"
}
]When creating a new Folder, there are a few options for copying permissions and also for placement of the Folder in the Password List Navigation Tree:
| Heading | Data Type | Description |
|---|---|---|
| CopyPermissionsFromPasswordListID | String | To copy permissions to the Folder from an existing Password List, you can specify the PasswordListID value for this field Note 1: By default, Folders inherit permissions from any nested Password Lists beneath them. So if you intend to create a Password List nested beneath this folder, you may not need to copy any permissions here Note 2: If you are nested this Folder beneath another Folder which is propagating its permissions down, then you cannot copy permissions from an existing Password List |
| CopyPermissionsFromTemplateID | String | To copy permissions to the Folder from an existing Password List Template, you can specify the TemplateID value for this field Note 1: By default, Folders inherit permissions from any nested Password Lists beneath them. So if you intend to create a Password List nested beneath this folder, you may not need to copy any permissions here Note 2: If you are nested this Folder beneath another Folder which is propagating its permissions down, then you cannot copy permissions from an existing Password List Template |
| NestUnderFolderID | String | If you would like this newly created Folder to be nested beneath another Folder or Password List, specify the FolderID or PasswordListID value here. If omitted, the Folder will be created in the root of the Navigation Tree - which is equivalent to the value of 0. |
| PropagatePermissions | Boolean | This is the setting which dictates if the folder is configured for the Standard or Advanced Permission model. Standard model inherits permissions from nested Password Lists, and Advanced model propagates it's permissions down to nested Password Lists. Note 1: This option can only be enabled for top level folders i.e. nested under Passwords Home, and will automatically be enabled if nested underneath another folder which is already propagating permissions down Note 2: You only need to use one of the 'CopyPermissions' settings above if PropagatePermissions is set to False, or PropagatePermissions is set to True for a top level folder i.e nested under Passwords Home |
| DisableInheritance | Boolean | This option can be used on Folders which is configured for the Advanced Permission model i.e. PropagatePermissions is True. When the option is set to True, it will not inherit any permissions from upper level folders which are propagating permissions down |
| Guide | String (NA) | Any associated instructions (guide) for how the Folder should be used (Can contain HTML characters). |
| SiteID | Integer | By default, the Site Location of 'Internal' will be used if an alternate Site Location is not used. Note: SiteID's can be referenced on the screen Administration -> Remote Site Administration -> Remote Site Locations. For the site of "Internal", the SiteID = 0. |