Introduction to Postman usage - Http request simulation tool

  In our usual development, especially when we need to deal with interfaces, whether we are writing interfaces or using interfaces, we must test them in advance after getting the interface. In this case, we need a powerful Http request simulation tool, which is popular now. There are also quite a few such tools, such as the Firefox browser plug-in-RESTClient, the Chrome browser plug-in-Postman and so on. Here we mainly introduce Postman. 

1. Postman description

  Postman is a chrome plugin for web page debugging and sending web page http requests. We can use it to easily simulate get or post or other requests to debug the interface.

Second, install (install to chrome plugin)

  When installing, it is best to open the chrome web store through the chrome browser and add it directly to the chrome plugin. If you download postman directly from the Internet, you may not be able to press chrome.

FQ is required to enter the chrome online store. By default, you can FQ. The general steps are as follows:

  1. Open the chrome web store of the chrome browser and search for postman.
  2. Click ADD TO CHROME.

 3. Basic usage

  Description: Here is an example of a post request that submits a multi-level nested json data format.

data=
{
    "xxx":
  {
        "xxx": "xxxxxxxxxxx",
        "xxx": "xxxxxxxxxxx"
    },
    "aaa": "xxxxxxxxxxx",
    "bbb": "xxxxxxxxxxx",
    "ccc": "xxxxxxxxxxx"
}

  1. After installing the postman plugin in chrome, a shortcut to Postman is usually generated on the desktop. When opening it again, you can open it directly through the shortcut or in the application in the chrome browser. We will see the following interface:

  2. After opening, enter the interface address to be tested in the red circle, select the post method, and then manually add a corresponding key value in the following Headers. This is very important and must be filled in correctly.

(For example, the submitted data in json format needs to be added: Content-Type: application/x-www-form-urlencoded, otherwise the request will fail)

As shown in the figure:

  3. Select the Body tab, then select row, and enter the parameters you need to submit in the edit box:

  4. Click Send to submit the request, and then view the request result below, which can be viewed in three ways: Pretty, Raw, and Preview. As shown in the figure:

 

Note: This document is just a simple example to meet our daily tests. For more details, please visit the official Postman website: https://www.getpostman.com

with

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326987909&siteId=291194637