Generate Random Passwords ​
You can generate one or more random Passwords from the API, either by specifying the settings manually, or by passing the PasswordGeneratorID value of one of the Password Generator options defined within Passwordstate.
There is only one field exposed via the API when generating a password, and it is the Password field itself.
Password
Data Type: String
Description: Randomly generated Password value.
Generating the Password
GET /winapi/generatepassword
Manual Password Generator Options Explained
When generating a random Password, you can either use the settings based on one of the saved 'Password Generator' options in Passwordstate, or you can specify all the settings manually. To specify the settings manually, you will need to understand what each of the parameters are intended for.
| Heading | Data Type | Description |
|---|---|---|
| IncludeAlphaSpecial | Boolean | Include Alphanumeric and Special Characters. |
| IncludeWordPhrases | Boolean | Include Word Phrases - random word will be generated. |
| CapitalizeWordPhrases | Boolean | Capitalize the first letter of each word phrase. |
| minLength | Integer | Minimum length for Alphanumeric and Special Characters. |
| maxLength | Integer | Maximum length for Alphanumeric and Special Characters. |
| lowerCaseChars | Boolean | Include lowercase characters. |
| upperCaseChars | Boolean | Include uppercase characters. |
| numericChars | Boolean | Include numeric characters. |
| higherAlphaRatio | Boolean | Include higher ratio of alphanumeric vs special characters. |
| ambiguousChars | Boolean | Include ambiguous characters - such as I, l, and 1. |
| specialChars | Boolean | Include special characters. |
| specialCharsText | String | List of special characters - such as !#$%^&*+/=_-. |
| bracketChars | Boolean | Include brackets. |
| bracketCharsText | String | List of brackets - such as [](){}<>. |
| NumberOfWords | Integer | The number of words to include. |
| MaxWordLength | Integer | Maximum word length to generate. |
| MinWordLength | Integer | Minimum word length to generate. |
| PrefixAppend | String | P to Prefix the Word, A to Append and I to Insert. |
| SeparateWords | String | Separate the generated Words with S for Spaces, D for Dashes and N for No Separation. |
| ExcludeChars | String | Exclude certain characters and numbers from the newly generated password. |
| GeneratePattern | Boolean | Generate based on a pattern of upper and lowercase letters, and numbers. |
| Pattern | String | l for Lowercase, u for uppercase, n for numbers and s for special characters, w for WordPhrase (with first letter in lowercase), W for WordPhrase (with first letter in uppercase) and any other literal characters i.e. ullllnnnnssss or W-W-W-uls |
| Qty | Integer | Generate one or more random passwords |
Powershell
# Generate one Password based on the 'Default Password Generator' options
$PasswordstateUrl = 'https://passwordstate/winapi/generatepassword/
# Generate one or more Passwords based on the 'Default Password Generator' options
$PasswordstateUrl = 'https://passwordstate/winapi/generatepassword/?Qty=<value>'
# Generate one Password based on a Password Generator option you specify
$PasswordstateUrl = 'https://passwordstate/winapi/generatepassword/?PasswordGeneratorID=<value>'
# Generate one or more Passwords based on a Password Generator option you specify
$PasswordstateUrl = 'https://passwordstate/winapi/generatepassword/?PasswordGeneratorID=<value>&Qty=<value>'
# Generate one or more Passwords based on options you specify for the Pattern Matching Option
$PasswordstateUrl = 'https://passwordstate/winapi/generatepassword/?GeneratePattern=True&MaxWordLength=<value>&MinWordLength=<value>&Pattern=<value>&Qty=<value>'
# Generate one Password based on options you specify manually
$PasswordstateUrl = 'https://passwordstate/winapi/generatepassword/?IncludeAlphaSpecial=<value>&IncludeWordPhrases=<value> _
&capitalizeWordPhrases=<value>&minLength=<value>&maxLength=<value>&lowerCaseChars=<value>&upperCaseChars=<value> _
&numericChars=<value>&higherAlphaRatio=<value>&ambiguousChars=<value>&specialChars=<value> _
&specialCharsText=<value>&bracketChars=<value>&bracketCharsText=<value>&NumberOfWords=<value> _
&MaxWordLength=<value>&MinWordLength=<value>&PrefixAppend=<value>&SeparateWords=<value>&ExcludeChars=<value> _
&GeneratePattern=<value>&Pattern=<value>'
# Generate one or more Passwords based on options you specify manually
$PasswordstateUrl = 'https://passwordstate/winapi/generatepassword/?IncludeAlphaSpecial=<value>&IncludeWordPhrases=<value> _
&capitalizeWordPhrases=<value>&minLength=<value>&maxLength=<value>&lowerCaseChars=<value>&upperCaseChars=<value> _
&numericChars=<value>&higherAlphaRatio=<value>&ambiguousChars=<value>&specialChars=<value> _
&specialCharsText=<value>&bracketChars=<value>&bracketCharsText=<value>&NumberOfWords=<value> _
&MaxWordLength=<value>&MinWordLength=<value>&PrefixAppend=<value>&SeparateWords=<value>&ExcludeChars=<value> _
&GeneratePattern=<value>&Pattern=<value>&Qty=<value>'
Invoke-Restmethod -Method GET -Uri $PasswordstateUrl -UseDefaultCredentialsJson
# Response
HTTP/1.1 200
[
{
"Password": "ZHn#3+A^yc",
}
]