当前位置:网站首页>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 .

边栏推荐
- PMP certificate preparation experience sharing
- Why is access to the external network prohibited for internal services of the company?
- NVIC interrupt priority management
- Synchronized underlying principle, volatile keyword analysis
- [chaosblade: delete pod according to the tag, pod domain name access exception scenario, pod file system i/o failure scenario]
- 串口实验——简单数据收发
- LeetCode 736. LISP syntax parsing
- Run can start normally, and debug doesn't start or report an error, which seems to be stuck
- 串口實驗——簡單數據收發
- Chaosblade: introduction to chaos Engineering (I)
猜你喜欢

Goldbach conjecture C language

Selenium mouse sliding operation event

Common short chain design methods

C language for calculating the product of two matrices

Several stages of PMP preparation study

面板显示技术:LCD与OLED

Upgrade Alibaba cloud RDS (relational database service) instance to com mysql. jdbc. exceptions. Troubleshooting of jdbc4.communicationsexception

LeetCode 715. Range module

Two schemes of unit test
![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]
随机推荐
Locust performance test 3 (high concurrency, parameter correlation, assembly point)
How to use Arthas to view class variable values
Analysis of Hessian serialization principle
Pytest+request+allure+excel interface automatic construction from 0 to 1 [five nails / flying Book notice]
Leetcode刷题记录(数组)组合总和、组合总和 II
OpenGL frame buffer
Simulation volume leetcode [general] 1706 Where does the ball meet
Systick滴答定时器
端口复用和重映像
Vagrant failed to mount directory mount: unknown filesystem type 'vboxsf'
Markdown editor Use of MD plug-in
硬件大熊原创合集(2022/05更新)
LeetCode 736. LISP syntax parsing
Digital triangle model acwing 1027 Grid access
C language pointer (Part 2)
Simple use of Xray
C language pointer (Part 1)
STM32 clock system
Serial port experiment - simple data sending and receiving
Expérience de port série - simple réception et réception de données