📜  postman动态变量

📅  最后修改于: 2021-01-08 02:07:32             🧑  作者: Mango

邮递员动态变量

顾名思义,动态变量会为您的API请求和收集运行生成随机数据。它就像是编程语言中的随机库。每次响应时它都会生成随机数据,例如随机数,字母,字母数字或颜色等。

动态变量名称以“ $”开头。在请求网址部分,应以{{__}}格式编写动态变量。

假设您必须传递1到1000之间的整数,因此,您需要添加{{ $ randomInt }}

就像上面的数字变量示例一样, Postman也支持许多其他动态变量。

一些重要的动态变量是

数字,文字和颜色

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

地址,位置,电话

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

职业

Variable Name Description
$randomJobType A random job type
$randomJobTitle A random job title
$randomJobDescriptor A random job descriptor
$randomJobArea A random job area

名字

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

日期

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

资料库

Variable Name Description
$randomDatabaseType A random database type
$randomDatabaseCollation A random database collection
$randomDatabaseColumn A random database column name

域,用户名和电子邮件

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

互联网和IP地址

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

文件和目录

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

图片

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

商业

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

金融

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)