Postman 動態(tài)變量

2023-04-04 10:33 更新

Postman 使用faker 庫生成樣本數(shù)據(jù),包括隨機名稱、地址、電子郵件地址等等。您可以多次使用這些預(yù)定義變量來為每個請求返回不同的值。

您可以像 Postman 中的任何其他變量一樣使用這些變量。它們的值是在執(zhí)行時生成的,它們的名稱以$符號開頭,例如$guidor $timestamp。

以下是動態(tài)變量的列表,其值是在請求/收集運行期間隨機生成的。

要在預(yù)請求或測試腳本中使用動態(tài)變量,您需要使用pm.variables.replaceIn(),例如pm.variables.replaceIn('{{$randomFirstName}}').

常見的

變量名描述例子
$guiduuid-v4風(fēng)格指南"611c2e81-2ccb-42d8-9ddc-2d0bfa65c1b4"
"3a721b7f-7dc9-4c45-9777-516942b98e0d"
"22eca807-006b-47df-9511-e92e37f5071a"
$timestamp當(dāng)前 UNIX 時間戳,以秒為單位15627571071562757108,1562757109
$isoTimestamp零 UTC 時的當(dāng)前 ISO 時間戳2020-06-09T21:10:36.177Z
2019-10-21T06:05:50.000Z
2019-07-29T18:29:00.000Z
$randomUUID一個隨機的 36 個字符的 UUID"6929bb52-3ab2-448a-9796-d6480ecad36b"
"53151b27-034f-45a0-9f0a-d7b6075b67d0"
"727131a2-2717-44ad-ab02-006587e947dc"

文本、數(shù)字和顏色

變量名描述例子
$randomAlphaNumeric一個隨機的字母數(shù)字字符6"y","z"
$randomBoolean隨機布爾值true,false
$randomInt0 到 1000 之間的隨機整數(shù)802494,200
$randomColor隨機顏色"red""fuchsia","grey"
$randomHexColor一個隨機的十六進制值"#47594a""#431e48","#106f21"
$randomAbbreviation隨機縮寫SQLPCI,JSON

互聯(lián)網(wǎng)和 IP 地址

變量名描述例子
$randomIP一個隨機的 IPv4 地址241.102.234.100,216.7.27.38
$randomIPV6一個隨機的 IPv6 地址dbe2:7ae6:119b:c161:1560:6dda:3a9b:90a9
c482:23a4:ce4c:a668:7736:6cc5:b0b6:cc37
c791:18d1:fbba:87d8:d929:22aa:5a0a:ac3d
$randomMACAddress隨機MAC地址33:d4:68:5f:b4:c7,1f:6e:db:3d:ed:fa
$randomPassword一個隨機的 15 個字符的字母數(shù)字密碼t9iXe7COoDKv8k3,QAzNFQtvR9cg2rq
$randomLocale隨機的兩字母語言代碼 (ISO 639-1)"ny""sr","si"
$randomUserAgent隨機用戶代理Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.9.8; rv:15.6) Gecko/20100101 Firefox/15.6.6
Opera/10.27 (Windows NT 5.3; U; AB Presto/2.9.177 Version/10.00)
Mozilla/5.0 (Windows NT 6.2; rv:13.5) Gecko/20100101 Firefox/13.5.6
$randomProtocol一個隨機的互聯(lián)網(wǎng)協(xié)議"http","https"
$randomSemver一個隨機的語義版本號7.0.52.5.8,6.4.9

名稱

變量名描述例子
$randomFirstName一個隨機的名字EthanChandler,Megane
$randomLastName一個隨機的姓氏SchadenSchneider,Willms
$randomFullName一個隨機的名字和姓氏Connie RunolfsdottirSylvan Fay,Jonathon Kunze
$randomNamePrefix隨機名稱前綴Dr.Ms.,Mr.
$randomNameSuffix隨機名稱后綴IMD,DDS

職業(yè)

變量名描述例子
$randomJobArea隨機工作區(qū)MobilityIntranet,Configuration
$randomJobDescriptor一個隨機的工作描述符ForwardCorporate,Senior
$randomJobTitle一個隨機的職位International Creative Liaison,
Product Factors Officer,
Future Interactions Executive
$randomJobType隨機工作類型SupervisorManager,Coordinator

電話、地址和位置

變量名描述例子
$randomPhoneNumber一個隨機的十位數(shù)電話號碼700-008-5275494-261-3424,662-302-7817
$randomPhoneNumberExt一個帶分機號的隨機電話號碼(12 位數(shù)字)27-199-983-3864,99-841-448-2775
$randomCity一個隨機的城市名稱SpinkahavenKorbinburgh,Lefflerport
$randomStreetName一個隨機的街道名稱Kuhic IslandGeneral Street,Kendrick Springs
$randomStreetAddress一個隨機的街道地址5742 Harvey Streets,47906 Wilmer Orchard
$randomCountry一個隨機的國家Lao People's Democratic RepublicKazakhstan,Austria
$randomCountryCode一個隨機的兩個字母的國家代碼(ISO 3166-1 alpha-2)CVMD,TD
$randomLatitude隨機緯度坐標(biāo)55.209927.3644,-84.7514
$randomLongitude隨機經(jīng)度坐標(biāo)40.6609171.7139,-159.9757

圖片

變量名描述例子
$randomAvatarImage隨機頭像圖片https://s3.amazonaws.com/uifaces/faces/twitter/johnsmithagency/128.jpg
https://s3.amazonaws.com/uifaces/faces/twitter/xadhix/128.jpg
https://s3.amazonaws.com/uifaces/faces/twitter/martip07/128.jpg
$randomImageUrl隨機圖像的 URLhttp://lorempixel.com/640/480
$randomAbstractImage隨機抽象圖像的 URLhttp://lorempixel.com/640/480/abstract
$randomAnimalsImage隨機動物圖像的 URLhttp://lorempixel.com/640/480/animals
$randomBusinessImage隨機庫存商業(yè)圖片的 URLhttp://lorempixel.com/640/480/business
$randomCatsImage隨機貓圖像的 URLhttp://lorempixel.com/640/480/cats
$randomCityImage隨機城市圖像的 URLhttp://lorempixel.com/640/480/city
$randomFoodImage隨機食物圖片的 URLhttp://lorempixel.com/640/480/food
$randomNightlifeImage隨機夜生活圖像的 URLhttp://lorempixel.com/640/480/nightlife
$randomFashionImage隨機時尚圖片的 URLhttp://lorempixel.com/640/480/fashion
$randomPeopleImage人的隨機圖像的 URLhttp://lorempixel.com/640/480/people
$randomNatureImage隨機自然圖像的 URLhttp://lorempixel.com/640/480/nature
$randomSportsImage隨機運動圖像的 URLhttp://lorempixel.com/640/480/sports
$randomTransportImage隨機交通圖像的 URLhttp://lorempixel.com/640/480/transport
$randomImageDataUri隨機圖像數(shù)據(jù) URIdata:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20baseProfile%3D%22full%22%20width%3D%22undefined%22%20height%3D%22undefined%22%3E%20%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22grey%22%2F%3E%20%20%3Ctext%20x%3D%220%22%20y%3D%2220%22%20font-size%3D%2220%22%20text-anchor%3D%22start%22%20fill%3D%22white%22%3Eundefinedxundefined%3C%2Ftext%3E%20%3C%2Fsvg%3E

金融

變量名描述例子
$randomBankAccount一個隨機的 8 位銀行帳號0945407365653440,75728757
$randomBankAccountName一個隨機的銀行賬戶名Home Loan Account,, Checking AccountSavings Account_Auto Loan Account
$randomCreditCardMask一個隨機的掩碼信用卡號36225815,6257
$randomBankAccountBic隨機 BIC(銀行識別碼)EZIAUGJ1KXCUTVJ1,DIVIPLL1
$randomBankAccountIban一個隨機的 15-31 個字符的 IBAN(國際銀行帳號)MU20ZPUN3039684000618086155TKZ
BR7580569810060080800805730W2
XK241602002200395017
$randomTransactionType隨機交易類型invoicepayment,deposit
$randomCurrencyCode一個隨機的 3 字母貨幣代碼 (ISO-4217)CDFZMK,GNF
$randomCurrencyName一個隨機的貨幣名稱CFP FrancCordoba Oro,Pound Sterling
$randomCurrencySymbol隨機貨幣符號$,
$randomBitcoin一個隨機的比特幣地址3VB8JGT7Y4Z63U68KGGKDXMLLH5
1GY5TL5NEX3D1EA0TCWPLGVPQF5EAF
14IIEXV2AKZAHSCY2KNYP213VRLD

商業(yè)

變量名描述例子
$randomCompanyName一個隨機的公司名稱Johns - Kassulke,Grady LLC
$randomCompanySuffix一個隨機的公司后綴IncLLC,Group
$randomBs商務(wù)演講的隨機短語killer leverage schemas,
bricks-and-clicks deploy markets,
world-class unleash platforms
$randomBsAdjective一個隨機的商務(wù)用語形容詞viral24/7,24/365
$randomBsBuzz一個隨機的商業(yè)流行語repurposeharness,transition
$randomBsNoun一個隨機的商務(wù)名詞e-servicesmarkets,interfaces

口頭禪

變量名描述例子
$randomCatchPhrase隨意的口頭禪Future-proofed heuristic open architecture,
Quality-focused executive toolset,
Grass-roots real-time definition
$randomCatchPhraseAdjective一個隨機的流行語形容詞Self-enablingBusiness-focused,Down-sized
$randomCatchPhraseDescriptor一個隨機的標(biāo)語描述符bandwidth-monitoredneeds-based,homogeneous
$randomCatchPhraseNoun隨機生成一個標(biāo)語名詞secured linesuperstructure,installation

數(shù)據(jù)庫

變量名描述例子
$randomDatabaseColumn一個隨機的數(shù)據(jù)庫列名updatedAttoken,group
$randomDatabaseType隨機數(shù)據(jù)庫類型tinyint,text
$randomDatabaseCollation隨機數(shù)據(jù)庫整理cp1250_binutf8_general_ci,cp1250_general_ci
$randomDatabaseEngine隨機數(shù)據(jù)庫引擎MyISAMInnoDB,Memory

日期

變量名描述例子
$randomDateFuture一個隨機的未來日期時間Tue Mar 17 2020 13:11:50 GMT+0530 (India Standard Time),
Fri Sep 20 2019 23:51:18 GMT+0530 (India Standard Time),
Thu Nov 07 2019 19:20:06 GMT+0530 (India Standard Time)
$randomDatePast一個隨機的過去日期時間Sat Mar 02 2019 09:09:26 GMT+0530 (India Standard Time),
Sat Feb 02 2019 00:12:17 GMT+0530 (India Standard Time),
Thu Jun 13 2019 03:08:43 GMT+0530 (India Standard Time)
$randomDateRecent一個隨機的最近日期時間Tue Jul 09 2019 23:12:37 GMT+0530 (India Standard Time),
Wed Jul 10 2019 15:27:11 GMT+0530 (India Standard Time),
Wed Jul 10 2019 01:28:31 GMT+0530 (India Standard Time)
$randomWeekday一個隨機的工作日ThursdayFriday,Monday
$randomMonth一個隨機的月份FebruaryMay,January

域、電子郵件和用戶名

變量名描述例子
$randomDomainName隨機域名gracie.bizarmando.biz,trevor.info
$randomDomainSuffix隨機域后綴orgnet,com
$randomDomainWord一個隨機的不合格域名gwenjaden,donnell
$randomEmail一個隨機的電子郵件地址Pablo62@gmail.comRuthe42@hotmail.com,Iva.Kovacek61@hotmail.com
$randomExampleEmail來自“示例”域的隨機電子郵件地址Talon28@example.comQuinten_Kerluke45@example.net,Casey81@example.net
$randomUserName隨機用戶名Jarrell.GutkowskiLottie.Smitham24,Alia99
$randomUrl隨機網(wǎng)址https://anais.nethttps://tristin.net,http://jakob.name

文件和目錄

變量名描述例子
$randomFileName隨機文件名(包括不常見的擴展名)neural_sri_lanka_rupee_gloves.gdoc,
plastic_awesome_garden.tif,
incredible_ivory_agent.lzh
$randomFileType隨機文件類型(包括不常見的文件類型)modelapplication,video
$randomFileExt隨機文件擴展名(包括不常見的擴展名)warbook,fsc
$randomCommonFileName隨機文件名well_modulated.mpg4,
rustic_plastic_tuna.gif,
checking_account_end_to_end_robust.wav
$randomCommonFileType一種隨機的、常見的文件類型application,audio
$randomCommonFileExt一個隨機的、通用的文件擴展名m2vwav,png
$randomFilePath隨機文件路徑/home/programming_chicken.cpio,
/usr/obj/fresh_bandwidth_monitored_beauty.onetoc,
/dev/css_rustic.pm
$randomDirectoryPath隨機目錄路徑/usr/bin/root,/usr/local/bin
$randomMimeType一個隨機的 MIME 類型audio/vnd.vmx.cvsd,
application/vnd.groove-identity-message,
application/vnd.oasis.opendocument.graphics-template

專賣店

變量名描述例子
$randomPrice0.00 到 1000.00 之間的隨機價格531.55488.76,511.56
$randomProduct隨機產(chǎn)品TowelsPizza,Pants
$randomProductAdjective一個隨機的產(chǎn)品形容詞UnbrandedIncredible,Tasty
$randomProductMaterial隨機產(chǎn)品材料SteelPlastic,Frozen
$randomProductName一個隨機的產(chǎn)品名稱Handmade Concrete Tuna,Refined Rubber Hat
$randomDepartment一個隨機的商業(yè)類別ToolsMovies,Electronics

語法

變量名描述例子
$randomNoun隨機名詞matrixbus,bandwidth
$randomVerb隨機動詞parsequantify,navigate
$randomIngverb以結(jié)尾的隨機動詞-ingsynthesizingnavigating,backing up
$randomAdjective一個隨機的形容詞auxiliarymulti-byte,back-end
$randomWord一個隨機的詞withdrawalinfrastructures,IB
$randomWords一些隨意的話Samoa Synergistic sticky copying Grocery,
Corporate Springs,
Christmas Island Ghana Quality
$randomPhrase隨機短語You can't program the monitor without navigating the mobile XML program!,
overriding the capacitor won't do anything, we need to compress the optical SMS transmitter!,
I'll generate the virtual AI program, that should microchip the RAM monitor!

求數(shù)

變量名描述例子
$randomLoremWordlorem ipsum 文本的隨機詞est
$randomLoremWordslorem ipsum文本的一些隨機詞vel repellat nobis
$randomLoremSentencelorem ipsum文本的隨機句子Molestias consequuntur nisi non quod.
$randomLoremSentences隨機的 2 到 6 個 lorem ipsum 文本句子Et sint voluptas similique iure amet perspiciatis vero sequi atque. Ut porro sit et hic. Neque aspernatur vitae fugiat ut dolore et veritatis. Ab iusto ex delectus animi. Voluptates nisi iusto. Impedit quod quae voluptate qui.
$randomLoremParagraph一段隨機的 lorem ipsum 文本Ab aliquid odio iste quo voluptas voluptatem dignissimos velit. Recusandae facilis qui commodi ea magnam enim nostrum quia quis. Nihil est suscipit assumenda ut voluptatem sed. Esse ab voluptas odit qui molestiae. Rem est nesciunt est quis ipsam expedita consequuntur.
$randomLoremParagraphs3 個隨機段落的 lorem ipsum 文本Voluptatem rem magnam aliquam ab id aut quaerat. Placeat provident possimus voluptatibus dicta velit non aut quasi. Mollitia et aliquam expedita sunt dolores nam consequuntur. Nam dolorum delectus ipsam repudiandae et ipsam ut voluptatum totam. Nobis labore labore recusandae ipsam quo.


Voluptatem occaecati omnis debitis eum libero. Veniam et cum unde. Nisi facere repudiandae error aperiam expedita optio quae consequatur qui. Vel ut sit aliquid omnis. Est placeat ducimus. Libero voluptatem eius occaecati ad sint voluptatibus laborum provident iure.

Autem est sequi ut tenetur omnis enim. Fuga nisi dolor expedita. Ea dolore ut et a nostrum quae ut reprehenderit iste. Numquam optio magnam omnis architecto non. Est cumque laboriosam quibusdam eos voluptatibus velit omnis. Voluptatem officiis nulla omnis ratione excepturi.

$randomLoremText隨機數(shù)量的 lorem ipsum 文本Quisquam asperiores exercitationem ut ipsum. Aut eius nesciunt. Et reiciendis aut alias eaque. Nihil amet laboriosam pariatur eligendi. Sunt ullam ut sint natus ducimus. Voluptas harum aspernatur soluta rem nam.
$randomLoremSlug隨機 lorem ipsum URL slugeos-aperiam-accusamusbeatae-id-molestiae,qui-est-repellat
$randomLoremLines1 到 5 行隨機 lorem ipsumDucimus in ut mollitia.
A itaque non.
Harum temporibus nihil voluptas.
Iste in sed et nesciunt in quaerat sed.


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號