《Django By Example》

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

2019-08-22  本文已影响0人  思考的虫子

记录一个在 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.

上一篇 下一篇

猜你喜欢

热点阅读