How to use postman

Postman sending requests

Open Postman, you can see that the interface is divided into left and right parts, the right is the collection we will talk about later, and the left is the request builder we will talk about now. In the request builder, we can quickly and arbitrarily assemble the request we want through Postman. In general, all HTTP Requests are divided into 4 parts, URL, method, headers and body. And Postman has targeted tools for these parts.

URL

To assemble a Request, the URL is always the first thing you need to fill in. The URL you have entered in Postman can be automatically completed through the drop-down. If you click the Params button, Postman will pop up a key-value editor, where you can enter the parameters of the URL, and Postman will automatically add it to the URL for you. On the contrary, if your URL already has parameters, then Postman will be in the URL. The parameters are automatically loaded when you open the key-value editor

write picture description here

Headers

Click the 'Headers' button, Postman will also pop up a key editor. Here, you can add the Header attribute you want at will, and Postman has passed a very intimate auto-complete function for us. Type a letter, and you can select the standard atrribute you want from the drop-down menu.

write picture description here

Method

It is very simple to select the Method of the Request. Postman supports all Methods, and once you select the Method, Postman's request body editor will automatically change according to your selection.

write picture description here

Request Body

If the request we want to create is similar to POST, then we need to edit the Request Body. Postman provides 4 editing methods according to the body type:

  • form-data
  • x-www-form-urlencoded
  • raw
  • binary

(We can upload files here)

demo

I create a request to send to google geocode here to see what the result is:

write picture description here

Note that in the URL I used the variable googleMaps and called it with {{}}, here is the syntax similar to AngulaJs (surely the same family), the return value is: http://maps.googleapis.com/maps/ api/geocode/json . And this variable is defined in my environment GoogleApiTest. This part of the content will be covered in the next article.

After clicking Send, you can directly see the content of the response on Postman. The content is very beautiful. Postman automatically displays it in JSON format according to the content retrieval. At the same time, we can clearly see the status code and the time spent.

write picture description here

 

Original text: https://blog.csdn.net/u013613428/article/details/51557804

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324890667&siteId=291194637