简体   繁体   English

Postman Chrome:如何将数组中的变量用于 URL

[英]Postman Chrome: how to use variables from an array for the URL

Sorry to bother you, but I really would use some help on the below:很抱歉打扰您,但我真的会在以下方面使用一些帮助:

I am using Postman Chrome extension against an Rest API.我正在针对 Rest API 使用 Postman Chrome 扩展程序。 My URI is like the following and the request type is PUT:我的 URI 如下所示,请求类型为 PUT:

PUT https://{{api-fqdn}}/some/path/to/something/ROLE111

I have about 100 roles with different names.我有大约 100 个不同名字的角色。

Instead of passing each time different role name at the end of the URI, how could I use Postman to scan an array and replace all the values inside using a variable, such as {{rolename}}?我如何使用 Postman 扫描数组并使用变量(例如 {{rolename}})替换内部的所有值,而不是每次都在 URI 的末尾传递不同的角色名称?

Thanks a ton in advance!提前致谢!

Take a look at using the native Postman app with the Collection Runner.看看如何使用带有 Collection Runner 的原生 Postman 应用程序。 You can create a data file (either JSON or CSV) with your different role names, The runner will replace that variable placeholder with the data from the file.您可以使用不同的角色名称创建数据文件(JSON 或 CSV),运行程序将使用文件中的数据替换该变量占位符。

More info can be found here: https://learning.postman.com/docs/postman/collection-runs/working-with-data-files/更多信息可以在这里找到: https : //learning.postman.com/docs/postman/collection-runs/working-with-data-files/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM