Research on testing API using Postman - bounswe/bounswe2022group7 GitHub Wiki

What is Postman?

Postman is an API platform that makes it easy for developers to create, share, test, and document APIs. This is done by allowing users to create and save simple and complex HTTP/s requests, as well as read their responses. Postman Native app is a standalone app that is available for download on various OS platforms like Windows, Mac OS, Linux, etc.

Building Blocks of Postman

  • A request is a combination of the complete URL (which includes all parameters or keys), HTTP headers, body or payload. These attributes altogether form a request. A great feature is that all the requests that you make to the server are stored in the Postman history for future reference.
  • A collection is like a repository in which we can save all our requests. Generally, the requests that hit the same API are kept in the same collection.
  • An environment is a region where all your operations on an API will take place. Each project will already have the regions configured and you just have to declare your global variables such as URL, token’s id and password, context keys, API keys, document keys and so on in it.

Getting Started

  1. Open the Postman Application and log in. The initial screen will look like this: image

  2. Create a new request and fill in the details. Let’s test an example get request for a REST API endpoint http://dummy.restapiexample.com/api/v1/employees

image

  1. When the request properties are filled in, press SEND to execute the request to the server hosting the endpoint. image

  2. When the server responds, we can check the response. Once the response completes, the response body tab is selected and displayed by default. Other parameters like the response status code, the time taken for the request to complete, and the size of the payload are shown just below the request headers.

image

  1. Next we can look at the other response tabs like Cookies and Headers. The cookies tab displays this:

image

  1. Also, we can navigate to the headers tab which contains a lot of useful information: image

References