Making HTTP GET requests with Postman

Now, we will use one of the GUI tools we installed, specifically Postman. We will use this GUI tool to compose and send HTTP requests to the web service.

The first time you execute Postman, you will see a modal that provides shortcuts to the most common operations. Make sure you close this modal so that we can focus on the main UI for Postman.

We will use the Builder tab in Postman to easily compose and send diverse HTTP requests to localhost:8000 and test the RESTful Web Service with this GUI tool. Postman doesn't support curl-like shorthand for localhost, and therefore, we cannot use the same shorthand we have been using when composing requests with HTTPie.

Select GET in the drop-down menu on the left-hand side of the Enter request URL textbox, and enter localhost:8000/toys/ in this textbox on the right-hand side of the drop-down menu. Then, click Send and Postman will display the following information:

  • Status: 200 OK.
  • Time: The time it took for the request to be processed.
  • Size: The approximate response size (sum of body size plus headers size).
  • Body: The response body with all the toys formatted as JSON with syntax highlighting. The default view for the body is Pretty and it activates syntax highlighting.

The following screenshot shows the JSON response body in Postman for the HTTP GET request to localhost:8000/toys/.

Click on the Headers tab on the right-hand side of the Body and Cookies tab to read the response headers. The following screenshot shows the layout for the response headers that Postman displays for the previous response. Notice that Postman displays the Status on the right-hand side of the response and doesn't include it as the first line of the key-value pairs that compose the headers, as when we worked with both the curl and http command-line utilities.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.254.35