Add Remote Session Credential ​
POST /userapi/rscredentials
Adding a new Remote Session Credential object can be achieved by making a POST request on the URL, with appropriate fields forming the HTTP message body.
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 -> Remote Sessions tab : 'Specify which users are allowed to add/edit/delete Remote Session Credentials from within the Remote Sessions Tab'
- If linking the Remote Session Credential to a password record, the user must have access to the password record
The PowerShell example below creates a Remote Session Credential record with various fields specified.
Powershell
#JSON data for the object
$Body = @{
Description = "RDP Sessions Domain Machines"
RemoteConnectionType = "RDP"
PasswordID = "57783"
}
$jsonData = $Body | ConvertTo-Json
$PasswordstateURL = 'https://passwordstate/userapi'
$result = Invoke-Restmethod -Method Post -Uri $PasswordstateURL'/rscredentials' -ContentType "application/json" -Body $jsonData -Header @{ "UserID" = "<UserID>" ; "APIKey" = "<APIKey>" }
Write-Output $result