API Health Monitor using Postman + Newman + Jenkins
API’s plays a key role nowadays as the systems interact with each other using a definite set of API’s.

There are a variety of use cases to which we might require a API health monitoring system be it external or internal API’s or if there has been a upgrade to the system then we can have a basic level of sanity testing as we do not want our codebase/services to get effected because of a down/changed API.
There are many third-party software/services that are available for this job. The problem that i faced with them was -
a) Software: It is not possible to install third-party software in an enterprise, the permission for the same has to be followed up using a long and tired process.
eg — API Fortress, AlertSite by SmartBear, Runscope
b) Services: The servers that we use to host our application either they do not have access to internet or the IP address through which these services try to ping our API are blacklisted.
eg — Postman Monitoring, Checkly
Thus I had to create an internal solution for the same.
Steps -
Installing Postman :
Either you can install postman as a standalone software or you can use it as a chrome extension.
Installing Newman :
Newman is the node module for Postman it is being used for testing API’s.
Installing Jenkins :
Similar to Postman either you can install Jenkins as a -
- Standalone software
2) Via war file
(I have installed it via war file)
Dummy API for Postman:
Creating a test API in Postman.
Exporting the dummy API and its environment from Postman to Newman:
- Import the Test scripts(collections) from the Postman by clicking on the Import button on Top

2. Update the input requests in API test scripts if required
3. Saved to the same collection and ensure Get method should follow Put method

4. Export the Test scripts by clicking on Export to the physical location and save

5. Once you are in the directory, run
newman run <collection_name. Json>,replacing the collection_name with the name used to save the collection.
Example: newman run CalendarWorkHours.postman_collection.json

Scheduling Newman job via Jenkins:
That’s it, you have created you own custom API health monitor. There are various other ways to scheduling the job using cron but I have used Jenkins as we will be using it with our other CI/CD integration's.
If you liked the article do share and you can connect with me via LinkedIn
