80
Postman Dynamic Variables
Dynamic variable, as the name suggests, generates random data to your API requests and collection run. It is like a random library in a programming language. It generates random data each time in response like a random number, alphabets, alphanumeric or color, etc.
A dynamic variable name starts with ‘$.’ In the request URL section, a dynamic variable should be written in {{__}} format.
Let’s say you have to pass an integer number from 1 to 1000, so for that, you need to add {{$randomInt}}.
Like the above example of the number variable, Postman supports so many other dynamic variables as well.
Some important Dynamic Variables are
Numbers, Texts and Colors
Variable Name | Description |
---|---|
$randomAlphaNumeric | A random alphanumeric character |
$randomInt | A random integer between 1 and 1000 |
$randomColor | A random color |
$randomHexColor | A random hex value |
$randomAbbreviation | A random abbreviation |
$randomBoolean | A random boolean value like true or false |
Address, Location, Phone
Variable Name | Description |
---|---|
$randomCountry | A random country |
$randomCountryCode | Random country code of two letters (ISO 3166-1 alpha-2) |
$randomCity | A random city name |
$randomStreetName | A random street name |
$randomStreetAddress | A random street address |
$randomLatitude | A random latitude coordinate |
$randomLongitude | A random longitude coordinate |
$randomPhoneNumber | A random 10-digit phone number |
$randomPhoneNumberExt | A random phone number with an extension of 12 digits |
Profession
Variable Name | Description |
---|---|
$randomJobType | A random job type |
$randomJobTitle | A random job title |
$randomJobDescriptor | A random job descriptor |
$randomJobArea | A random job area |
Names
Variable Name | Description |
---|---|
$randomFullName | A random first and last name |
$randomNamePrefix | A random name prefix |
$randomNameSuffix | A random name suffix |
$randomFirstName | A random first name |
$randomLastName | A random, last name |
Dates
Variable Name | Description |
---|---|
$randomWeekday | A random weekday |
$randomMonth | A random month |
$randomDateRecent | A random recent datetime |
$randomDateFuture | A random future datetime |
$randomDatePast | A random past datetime |
Databases
Variable Name | Description |
---|---|
$randomDatabaseType | A random database type |
$randomDatabaseCollation | A random database collection |
$randomDatabaseColumn | A random database column name |
Domains, Username, and Emails
Variable Name | Description |
---|---|
$randomUrl | A random URL |
$randomUserName | A random username |
$randomEmail | A random email address |
$randomDomainName | A random domain name |
$randomDomainSuffix | A random domain suffix |
Internet and IP address
Variable Name | Description |
---|---|
$randomIP | A random IPv4 address |
$randomIPV6 | A random IPv6 address |
$randomPassword | A random alphanumeric password of 15-character |
$randomUserAgent | A random user agent |
$randomProtocol | A random internet protocol |
$randomMACAddress | A random MAC address |
Files and Directories
Variable Name | Description |
---|---|
$randomCommonFileName | A random file name |
$randomFileName | A random file name (includes uncommon extensions) |
$randomFileExt | A random file extension (includes uncommon extensions) |
$randomFileType | A random file type including uncommon file types |
$randomCommonFileType | A random, common file type |
$randomCommonFileExt | A random, common file extension |
$randomDirectoryPath | A random directory path |
Images
Variable Name | Description |
---|---|
$randomImage | A random image |
$randomImageUrl | A URL for a random image |
$randomAnimalsImage | A URL for a random animal image |
$randomCityImage | A URL for a random city image |
$randomFoodImage | A URL for a random food image |
$randomTransportImage | A URL for a random transportation image |
$randomSportsImage | A URL for a random sports image |
$randomTechnicsImage | A URL for a random tech image |
Business
Variable Name | Description |
---|---|
$randomCompanyName | A random company name |
$randomCompanySuffix | A random company suffix (e.g., Inc, LLC, Group) |
$randomBs | A random phrase of business-speak |
Finance
Variable Name | Description |
---|---|
$randomCurrencyName | A random currency name |
$randomCurrencySymbol | A random currency symbol |
$randomCurrencyCode | A random 3-letter currency code (ISO-4217) |
$randomBitcoin | A random bitcoin address |
$randomTransactionType | A random transaction type (e.g., invoice, payment, deposit) |
$randomBankAccount | A random bank account number of 8-digit |
$randomBankAccountName | A random bank account name (e.g., savings account, checking account) |
Next TopicIntro to Scripts