Postman helps you to be more efficient while working with APIs. You can build, test, and document your APIs faster, and share your work with other developers. It is much more handy and easier to use than Fiddler and SoapUI.
Postman is a Chrome application. You need to install Google Chrome before installing Postman. I skip this here, since you can easily find out the way to install it from Google.
Basic features
When testing an API, you can select your desired HTTP method, such as Get, Post, or Put.
You can enter different headers, such as content type and authorization.
When you select “POST” and “application/json” content type, you need to enter request body as below:
Environment Variables
If you need to pass the value from one API result (for example, an authentication token as parameter to another API call), you can make use of its “Manage Environments” feature.
Using “Manage Environments”, you can set up different environment variables, either global or within a defined scope.
For example, “token” variable is set up below as a global variable.
In the API call which generates the token, I use these snippets to set the value of the global variable.
- var jsonData = JSON.parse(responseBody);
- postman.setGlobalVariable("token", 'bearer ' + jsonData.access_token);
Then, the variable can be used in other subsequent API requests. You can use them in the header or the request body. They should be wrapped with double curly brackets.
Collection and Share
The Beauty of Postman is that you can save related API endpoints into a collection and share the entire collection to other developers. Once they get the collection link, they can import the collection and continue with your work without any extra effort.
There are still a lot of good features from Postman, but these are enough for you to build and test your API efficiently.