当前位置:网站首页>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 Exam details after the release of the new exam outline
- Digital triangle model acwing 1027 Grid access
- How to pass the PMP Exam in a short time?
- ChaosBlade:混沌工程简介(一)
- Full link voltage test of the e-commerce campaign Guide
- 2022-06-30 unity core 8 - model import
- Selenium mouse sliding operation event
- Port occupation troubleshooting
- What is the use of PMP certificate?
- C language pointer (Part 2)
猜你喜欢
Druid monitoring - Introduction to JMX usage and principle
NVIC interrupt priority management
Postman interface test (II. Set global variables \ sets)
STM32的时钟系统
Port multiplexing and re imaging
How long does the PMP usually need to prepare for the exam in advance?
2021 year end summary
Panel display technology: LCD and OLED
Postman interface debugging method
Locust performance test 4 (custom load Policy)
随机推荐
Leetcode刷题记录(数组)组合总和、组合总和 II
寄存器地址名映射
NVIC中断优先级管理
What are the suggestions for PMP candidates?
How can I apply for a PMP certificate?
Postman interface debugging method
Postman interface test (I. installation and use)
面试题:高速PCB一般布局、布线原则
Detailed learning notes of JVM memory structure (I)
[chaosblade: node CPU load, node network delay, node network packet loss, node domain name access exception]
Simulation volume leetcode [general] 1706 Where does the ball meet
C语言指针(特别篇)
Common short chain design methods
Idea development environment installation
Digital triangle model acwing 275 Pass a note
C语言指针(习题篇)
C language pointer (Part 2)
Digital triangle model acwing 1027 Grid access
Reflections on the way of enterprise IT architecture transformation (Alibaba's China Taiwan strategic thought and architecture practice)
C language for calculating the product of two matrices