Maybe you think Postman monitors are only for your QA or DevOps team to make sure your API endpoints are up and running properly. While it’s true that Postman monitors are powerful tools to do just that, there are a bunch of other ways you can use them.
A Postman monitor is simply a collection run scheduled at some regular interval. People can use it to monitor the health of their API endpoints, to make sure the endpoints are responsive and returning the correct data as frequently as every 5 minutes from 6 different regions around the world.
In addition to monitoring the health of their own APIs, the team at Postman uses monitors for all sorts of things.
- Keep track of GitHub Issues submitted by Postman users every weekday
- Reduce lunch decision anxiety by picking where to go for lunch a few days every week
- Ensure Postman team members are in compliance by running a weekly audit
Here’s one example of how I used a Postman monitor — to water my rooftop plants.
I have a little army of plants scattered throughout my home and also on my rooftop. I don’t go up to my rooftop often enough to see when my plants have gotten crispy and dry, and as such, a number of beautiful plants have perished under my neglectful brown thumb.?
There had to be a better way to water my plants.
Setting up the hardware
I rigged a small hose to run from an inside sink to the roof. The hose connects to a valve controlled by a tiny Arduino server. A
GET request sent to this server will release 15 seconds of water for my rooftop plant.
Now that my watering endpoint was set up on the Arduino server, I could trigger a watering simply by entering the endpoint into a browser. I could do it at home, from work, on a train… but this solution still relied on my forgetful human brain. Furthermore, mischievous hackers could spend all their time hitting this endpoint and potentially flooding my rooftop.
I knew I could do better.
Postman to the rescue
I created a Postman collection to submit a
POST request that requires a password to trigger my watering endpoint, instead of an open
GET request. A
POST request also made sense because we were CREATING water. ?
I didn’t have to design and develop a form to submit this request, because Postman would do that for me. Additionally, a Postman monitor could run my collection every day.
Unfortunately, running the Postman collection every day resulted in my poor plants being over-watered, so I updated the collection. I added a
GET request that would first check what day of the week it was before running the remainder of the collection if it was a watering day. If it was a skip day, the collection would terminate after the initial check. I decided to water my plants every Monday, Wednesday, and Friday.
I could feel my thumb starting to turn green!
I also staked a hygrometer in my favorite avocado plant to keep an eye on the moisture levels in the soil. Now, my Postman collection would only water my plants if it was a watering day AND if the soil wasn’t already too wet.
Try it yourself
Click the orange Run in Postman button to import the sample collection and environment template into your Postman app. Run the collection locally using the example endpoint to water our virtual plants.
If you’ve deployed your own personal endpoint, then swap out the value in the environment to water your own plants. Adjust the watering logic to suit your type of plants. Don’t have a hygrometer? Try calling an API to get a weather forecast instead. Once it’s working as you want it, set up a monitor to schedule the collection to run at regular intervals.
Check it out – it’s waterful!
Need help getting started? Read the Water my Rooftop Plants documentation for step-by-step instructions.