Interface testing tool-Postman use detailed explanation
1. Install postman
Official website download address: https://www.postman.com/downloads/
Choose the corresponding version to download, and install it directly after downloading.
2. Postman interface description
3. POSTMAN interface request method
GET请求:点击Params,输入参数及value,可输入多个,
Response example: display the request response status code, response time, and response file size
Response body example: There can be multiple response formats. I am here because the request is Baidu, so the response is in html format.
Under normal circumstances, if we customize the interface, it is the response body in json format. For commonly used restful interfaces, the basic All return messages in json format
2. POST请求
POST请求一:表单提交
In the example below, the request method, request URL, and request parameters are set, but the request header is not set. The request header is automatically generated according to the form of the request parameter
There is an association between the Content-Type in the request header and the format of the request parameters, such as:
POST request 2: json submission
As shown in the figure below, when we select JSON (application/json), it will automatically set the headers to application/json for us
POST request three: xml submission
POST request four: binary file submission
Other request methods such as PUT and DELETE are roughly the same as GET and POST, so I won’t give an example one by one here.
4. Management use case-Collections
Collections collection: that is, multiple interface requests can be put together and managed, and a collection is created in the same project, which is convenient for searching and unified processing of interfaces.
The first step is to create Collections.
Click the icon with the + sign in the figure above, enter Name: "abc", Description: "Sample demo", and click the Create button to create a collection successfully. The
second step is to add a request to Collections
After preparing all the data requested by the interface on the right side and verifying it, click the save button.
You can see it here after you save it, and you can click here when you want to call it again later, which is convenient and quick
Collections management is refined, here we group different requests and add subfolders