例:

A接口:新建事项,返回事项id

B接口:修改事项,参数需要传事项id

需要把A接口的返回值传给B接口作为参数使用

 

假设A接口返回值

{
    "message": {
        "errcode": "0",
        "errmsg": "success"
    },
    "Id": "5816810851994875644"
}

此时切换到Tests,输入如图

var data = JSON.parse(responseBody)
pm.environment.set("ID", data.Id);  

postman参数传递

 

在请求A接口之后,环境变量中会生成一个临时变量ID,存放A接口返回的Id值

B接口在使用时,参数值输入{{ID}}即可。

 

相关文章:

  • 2022-02-17
  • 2022-02-14
  • 2022-01-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
  • 2021-06-14
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-14
  • 2021-12-13
  • 2022-12-23
  • 2021-05-25
  • 2021-09-20
相关资源
相似解决方案