API Tools

When developing an API it is often necessary to test the API outside of the GUI application(s) which are going to consume it.  This can allow the developer to test the API and ensure that the response returned is correct as well as testing the reliability, performance and security of the API.  There are several API testing tools available including SoapUI, Insomnia but in Dataworks we use Postman.  The API testing tools allow us to test the response based on passing a specific set of data to the API allowing us to verify the response is as expected.


About Postman

Postman is a lightweight, fast GUI that allows a user to test an API through a number of HTTP requests including GET, PUT, POST and DELETE.  It allows users to create and share API requests, which can also be added to a Collection allowing requests to be grouped together as required.  It also displays a history of requests making it easy to re-run recent requests or to compare request results.

Setting Up Postman

Getting Postman set up and running is very straight forward.  Chrome is currently still available as an add on in the Chrome Browser Web Store, however this is being deprecated so it is best to install the standalone app now directly from https://www.getpostman.com/.

Once installed when you open the application you will be presented with the Postman GUI.  This GUI displays the following:

  • Dropdown list representing the type of request
    • GET
    • POST
    • PUT
    • Etc…
  • Request URL
  • Send Button
    • Option to Send and Download the response
  • Save Button
    • Option to save the request and add it to a collection or folder
  • Additional tabs to display information relating to the Request
    • Params
    • Authorization
    • Headers
    • Etc

Below this is the response window.  The response can be displayed in a number of formats depending on the API. The options available include:

  • JSON
  • XML
  • HTML
  • Text
  • Auto

Fig 1 – Basic GET request

Postman Requests Examples

HTTP GET Requests

When sending GET requests, with parameters, there are two options for setting the query string.  The request can be set up with parameters under the Params tab setting the Key and Value which will automatically update the URL with query string, or you can include query string directly into the URL which in turn will set up the params tab.

Fig 2 – GET request with parameters

HTTP POST Requests

A POST request is used to send data to the server, which can be sent in multiple formats defined by the MIME type.  Postman caters for the commonly used formats

  • application/json
  • application/x-www-form-urlencoded
  • multipart/form-data
  • text/plain
  • application/xml

Fig 3 – POST Request (form data example)

Fig 4 – POST Request (application/json example)

Postman Collections

A collection in Postman is used to group individual requests together.  These requests can also be organised into folders.  There are a number of advantages to creating a collection:

  • Groups requests together removing the need to search through your history
  • A collection can be given a name and a description and can be used to provide documentation relating to the requests.
  • Collections can be shared among team members

Postman Automated Testing

It is possible to use Postman as part of your development teams Continuous Integration, along with Newman and Jenkins.

  • Newman is a command line collection runner for Postman
  • Jenkins is a continuous integration server.

This automated testing setup is not something that we have currently utilised in Dataworks, however, for more information on this please visit https://www.getpostman.com/docs/v6/api_testing_and_collection_runner/integrating_with_jenkins

At Dataworks we enable the perfect hybrid of configurable off the shelf toolsets and custom software development to deliver innovative solutions to match your specific business process requirements. This ensures we are the best at what we do.

If you would like to discuss how we can use our experience and expertise to deliver real benefits to your business please Contact Us today or call us on 051 878555.

To stay up to date with Dataworks Limited news and events, connect with us via the links below: