当前位置:网站首页>Data association between two interfaces of postman
Data association between two interfaces of postman
2022-07-07 09:13:00 【zhangyr0916】
scene :
Driver login account app, The driver grabs the bill
After the driver logs in successfully , The server returns a token, The driver's request for a ticket header Add the corresponding token, To grab the order .
Ideas :
1、 Get the return of login interface first token data
2、 extract json Medium access_token Field , And save it to a Postman variable
3、 In the order grabbing interface , Use { { Variable name }} Call the variable value saved by the previous interface
step :
① Create a collection , Put the interface of a module into a set ;

② Create a HTTP request , According to the information in the interface document , Add login interface URL And parameters , Test the driver login interface ;

③ Click on “Send”, Check the interface below to return , return message For success ,access_token The field is returned by the login interface token value , Interface debugging succeeded ;

④ Get the login interface and return json Medium token value ( Use HTTP Request... In the component Test Script ,Test The script is in HTTP Some execution after the request JavaScript Code );
stay Tests Written in JavaScript Code acquisition token, The script is as follows :
// Get the return of the interface json data
var jsonData = pm.response.json();
var sj_token = jsonData.access_token;
// Will the driver token Save in variables sj_token in
pm.globals.set("sj_token",sj_token)

⑤ Create order grabbing interface , Add order grabbing interface URL And parameters ;

⑥ The requested header in , Add just saved token value , Use { {}} To quote Postman Parameters of ;

⑦ Click on “Send” Button , Check the interface return value , Interface request succeeded .

边栏推荐
- Hard core sharing: a common toolkit for hardware engineers
- 【istio简介、架构、组件】
- STM32串口寄存器库函数配置方法
- 外部中断实现按键实验
- STM32 serial port register library function configuration method
- Simulation volume leetcode [general] 1706 Where does the ball meet
- STM32 clock system
- Output all composite numbers between 6 and 1000
- Analysis of Hessian serialization principle
- Confitest of fixture py
猜你喜欢

Digital triangle model acwing 275 Pass a note

C language pointer (Part 1)

E-commerce campaign Guide

Several stages of PMP preparation study

Locust performance test 3 (high concurrency, parameter correlation, assembly point)

C language pointer (exercises)

Register address name mapping

MySQL common statements
![Pytest+request+allure+excel interface automatic construction from 0 to 1 [five nails / flying Book notice]](/img/5f/a3e7ed3617f1fec024eaba086ddd2a.jpg)
Pytest+request+allure+excel interface automatic construction from 0 to 1 [five nails / flying Book notice]

Storage of data in memory
随机推荐
When inputting an expression in the input box, an error is reported: incorrect string value:'\xf0\x9f... ' for column 'XXX' at row 1
Simple use of Xray
Storage of data in memory
What is the value of getting a PMP certificate?
2020 year end summary
The essence of high availability
What are the conditions for applying for NPDP?
寄存器地址名映射
Original collection of hardware bear (updated on May 2022)
[istio introduction, architecture, components]
Ppt template and material download website (pure dry goods, recommended Collection)
Leetcode刷题记录(数组)组合总和、组合总和 II
[chaosblade: node CPU load, node network delay, node network packet loss, node domain name access exception]
Several stages of PMP preparation study
Reflections on the way of enterprise IT architecture transformation (Alibaba's China Taiwan strategic thought and architecture practice)
串口实验——简单数据收发
硬件大熊原创合集(2022/06更新)
硬核分享:硬件工程师常用工具包
NVIC interrupt priority management
Unity shader beginner's Essentials (I) -- basic lighting notes