如何获取 Postman Environment 和 Postman Globals URL 以传递给 Newman? [英] How to get Postman Environment and Postman Globals URLs for passing to Newman?

查看:56
本文介绍了如何获取 Postman Environment 和 Postman Globals URL 以传递给 Newman?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Newman 帮助指定集合、环境和全局变量可以作为路径或 URL 传递.我可以看到如何从 Postman 获取收藏 URL(通过转到共享">收藏链接").
如何在 Postman 中获取 Environment 和 Globals 的 URL,以便将它们传递给 newman?

Newman help specifies that collection, environment and globals can be passed as a path or as a URL. I can see how to get a collection URL from Postman (by going to Share > Collection Link).
How can I get the URLs to Environment and Globals in Postman, so I could pass them to newman?

推荐答案

将 Newman 与 Postman Pro API 结合使用:

Using Newman with the Postman Pro API:

  1. 生成 API 密钥
  2. 从以下位置获取您的收藏列表:
  1. Generate an API key
  2. Fetch a list of your collections from:
https://api.getpostman.com/collections?apikey=$apiKey

  • 通过其 UID 获取集合链接:

  • Get the collection link via its UID:

    https://api.getpostman.com/collections/$uid?apikey=$apiKey
    

  • 从以下位置获取环境 URI:

  • Obtain the environment URI from:

    https://api.getpostman.com/environments?apikey=$apiKey
    

  • 使用在第 3 步和第 4 步中获取的集合和环境 URI,按如下方式运行集合:

  • Using the collection and environment URIs acquired in steps 3 and 4, run the collection as follows:

    newman run "https://api.getpostman.com/collections/$uid?apikey=$apiKey" \
        --environment "https://api.getpostman.com/environments/$uid?apikey=$apiKey"
    

  • 纽曼包链接

    这篇关于如何获取 Postman Environment 和 Postman Globals URL 以传递给 Newman?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆