Postman 获取返回值再放到下一个请求中

记录一个在 SO 上发的一个自问自答
read the source

Let's say I want to create a new obj called 'qif' then get its id, and then update it.

  1. In Postman open the first request - Test tab enter:
var jsonData = JSON.parse(responseBody);
pm.environment.set("new_create_qif_id", jsonData.id);
image.png
  1. after sending the request you will get the environment valuable new_create_qif_id ready.
image.png
  1. use {{new_create_qif_id}} in request body or URL, it will be updated every time we run the collection or folder
image.png

Requesting token is just the same.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容