Using Postman to test REST APIs

When testing SOAP web services almost everyone uses SOAP UI. In terms of REST APIs testing I like to use Postman instead. In this post I am going to show what you can achieve or do with Postman that is available as a Chrome App or Mac App.

  • Storing REST calls in collections
By clicking Save button in the right hand side you can store the requests you are working on.

You can store them in collections. You can also create folders inside those collections.

Collections can be shared or downloaded as a json file.
  • Manage environments
Environments holds variables that can be used in a request.
You can have as many environments as you want. There is an option to also create global variables that applies to your requests although you don’t have any environment selected.

This is an example of my MCS environment.

Having a variable called ‘MobileBackendId’, you can use it in the request like this: {{MobileBackendId}}
  • Executing pre-request scripts
You can also execute a script before a request is done. In this example, instead of changing the date before each request, you can create a script that fills currentDate variable with the system date and also formats the date.

  • Create tests
When a request is executed, you have a way to know if it is working fine without having to look the response.
For example I have created 2 tests:

  • If the body contains ‘message’ property.
  • If the response code is 202.

After executing the request you will see if the tests has passed or not.

You Might Also Like

Leave a Reply