support Posted March 14 Share Posted March 14 This API script in Powershell is designed to update the Field IDs for any password records with a matching URL. It designed as a quick way to bulk update multiple records that are used with the Browser extension, instead of manually updating every record you have in the system. This will help with the autofill feature in the browser extensions. The script will return all shared passwords in the system, and filter only the records with the URL of your choice. It will then update those records with the Field ID value of your choice. You only need to modify the first four lines in the script. Line 1 is your Passwordstate URL Line 2 is your System Wide API key which can be found/generated under Administration -> System Settings -> API tab Line 3 is the value of the URL in any password records that you want to update Line 4 is the value of the FieldID that you will be updating any password record with -------------------------------------------------------------------------------------------------------------------------------------------------------- $PasswordstateURL = "https://passwordstate.clickdemo.com" $APIKey = "5347c386f9bad2edc2ef9563a874b33e" $MatchingURL = "amazon.com" $FieldValue = "ap_email" $QueryAllPasswordsURL = "$PasswordstateURL/api/passwords/?QueryAll&PreventAuditing=false" $passwords = Invoke-Restmethod -Method GET -Uri $QueryAllPasswordsURL -Header @{ "APIKey" = $APIKey } foreach ($password in $passwords) { $passwordID = $password.PasswordID $URL = $password.URL if ($URL -match $MatchingURL) { $Body = @{ PasswordID = $passwordID WebUser_ID = $FieldValue } # Convert Array to Json $jsonData = $Body | ConvertTo-Json $UpdateURL = "$PasswordstateURL/api/passwords" $result = Invoke-Restmethod -Method Put -Uri $UpdateURL -ContentType "application/json" -Body $jsonData -Header @{ "APIKey" = $APIKey } } } -------------------------------------------------------------------------------------------------------------------------------------------------------- Regards, Support Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now