1. New Collection
Open the postman, click Collections-> New Collection, shown below:
2. Create request
The following information for the binding interface as an example
Interface Description:
C {} acquiring the binding information Interface
Interface Address: https://apibeta.allolike.com/account/bindinfo/get
By interface documentation, we find that the interface need to pass parameters ticket, and ticket parameters need to be obtained through the following two interfaces
A {phone login interfaces}: https://apibeta.allolike.com/oauth/token
B {Get ticket Interface}: https://apibeta.allolike.com/oauth/ticket
Three interfaces related as follows:
A token as a parameter interface to obtain an interface to obtain B ticket, and then passed as a parameter C interface to obtain binding information
New request operations shown below:
3. interface association
A interface requests as follows:
Then select Tests, enter the following code:
pm.test("获取token", function () {
var jsonData = pm.response.json();
pm.globals.set("Token",jsonData.data.access_token);
});
Then create a global variable Token, do not enter value
B interface requests as follows:
Note that the previous interface parameters need to be written in the form of a variable passed in the next interface
Then the same operation of the A interface, select Tests, enter the following code:
pm.test("获取ticket", function () {
var jsonData = pm.response.json();
pm.globals.set("Ticket",jsonData.data.tickets[0].ticket);
});
然后新建全局变量Ticket,不用输入值
C接口请求如下:
更多接口关联同上操作
4.运行集合
操作如下,点击Run—>Run Test即可: