Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”

Project development process, the need for the interface of the deployment environment test, without the use of Postman, whereas in be used actually, unstructured learning a lot of features and content and I do not know why, today is to comb the record Postman tool interface function and use simple process, in order to improve the efficiency of project development.

1. The Postman is introduced

Postman is a web debugging tool that sends HTTP requests. Developers can use it to track web requests when developing or debugging web applications, web B/S programs, and some network monitoring tools, such as Firebug. As a powerful web request tool, Postman can send almost all types of HTTP requests.

As an API request testing tool, Postman also provides functions such as Collections, which allow users to organize their interfaces to facilitate overall project development and testing.

Postman’s official website: www.postman.com/

2. Download and install Postman

Postman can be used in a variety of forms, such as Web pages, Chrome plug-ins, client programs

Web page version 2.1

You can access the Postman web page through the Postman web page. When making a request, you need to select an appropriate proxy; otherwise, some interfaces cannot be accessed

2.2 the Chrome plug-ins

Search for the Postman plugin in the Chrome browser Store to get the installation. To install the Postman plugin in the Google Store, you need a ladder.

2.3 the client

Postman officially provides three types of clients: Windows, MAC, and Linux. You can download and install the corresponding programs to use the Postman client. The Postman client is the most flexible and has the most rich functions of the three methods.

  • Windows client download: www.postman.com/downloads/

3. Postman usage process

The Postman client has the most complete and comprehensive functionality, using the client to request the page.

After opening Postman, click Create New in the Home TAB and select HTTP Request to enter the API Request test page.

The following figure shows the display information of the request page:

3.1 Request Name

Postman supports saving requests. Press Ctrl + S or click Save on the request page to save the current request information for subsequent reuse. The request name is the custom name used to save the request information.

Untitled Request is displayed if the Request is not saved.

3.2 Request Types

Postman supports many request types, such as GET, POST, PUT, PATCH, and DELETE

GET

GET The user obtains corresponding data information from the specified API interface without any data modification on the server. Enter the URL to request and click Send to complete the request. The request result is displayed in the Response area below.

GET request is only used to obtain data. When performing GET request in Postman, if it needs to carry parameters, it only needs to add corresponding parameters in Params, and the parameters in the final request will be splicing after URL in the form of {KEY}={VALUE}.

How to use a GET request:

  1. Select the request type as GET
  2. Enter the URL to request
  3. GET Indicates the parameter information to be carried in the request. It is in the key-value format and can be empty
  4. Click on theSendTo request
  5. View request results and returned data information

POST

POST is a request operation that submits data to the API interface. It can update or delete specified data information based on the data provided by us.

Since server data may be changed during POST requests, most POST requests need to be verified, and information related to API verification needs to be configured on the Authorization parameter page. The relevant data carried by a POST request can be configured in either the request Headers or the request Body.

How to use a POST request:

  1. Select the request type as POST
  2. Fill in the URL to request
  3. If authentication is required for API requests, use Authorization to configure the authentication type or use token authentication in the Headers request header
  4. Select the Body tag and configure the request parameters
  5. When request parameters are used, select RAW source format transmission
  6. Selecting JSON indicates that parameters are entered in JSON format
  7. Parameter input field, write multiple parameters in JSON format, essentially key-value object form
  8. Click on theSendTo initiate the request
  9. View the returned request result information

3.3 Request Parameters

Postman uses Params, Authorization, Headers, and Body parameters in the most commonly used GET and POST requests.

  • Params: Configures request parameters of type GET, executed after concatenation of the URL
  • Authorization: Authentication information configuration, used for POST requests
  • Headers: Sets the request header information, such as browser information, during a POST request
  • Body: Indicates the Body information of a POST request, which is generally used to submit service-related parameters
    • None: None. The parameter is null
    • From-data: indicates the form submission mode, which is sent in key-value format
    • X-www-from-urlencoded: Concatenated after urls in key=value format
    • Raw: Parameter information in source code format. Parameter information can be written in Text, JavaScript, JSON, HTML, or XML format. The most commonly used format is JSON data transmission.
    • Binary: transfer of a binary file
    • GraphQL: Query language for application programming interfaces
  • Cookies: Used to manage the Cookies of requested URLS

3.4 Result

  • Body
    • Pretty: results beautify display, select Pretty, but also for the results of the data display format to choose. For example, you want to parse the data into HTML, JSON, XML, and TEXT formats.
    • Raw: Raw, that is, returned result data without any modification
    • A Preview of returned data, such as HTML, is displayed as web page information
  • Cookies: Returns the Cookies information contained in the result
  • Headers: Returns the Header information in the result
  • Status: Indicates the Status of the request result, indicating whether the request succeeds or fails
  • Time: only the Time is requested
  • Size: Indicates the Size of the result data

4 summarizes

This article sorts out and records the use process of Postman’s common functions, and then uses Postman to test API, we will have a deeper understanding. Although it is relatively simple content, the process of sorting out is also a learning process, which can add some harvest. I hope this article can help you, and I will review the advanced use of Postman when I have time.