A REST API for My Houseplant
My pothos now exposes a fully RESTful API. GET /moisture returns a float and a vague sense of judgment. GET /mood returns one of three states: thriving, dramatic, or “you said you’d water me on Tuesday.” There is no PUT /water, because the plant believes hydration is a thing that should happen to it, not a thing it should have to request.
I added authentication after the plant started getting unsolicited traffic. It now requires a bearer token, which is a leaf. If you do not have a leaf, you are not authorized, and honestly that is a more coherent security model than several production systems I have audited.
Uptime has been excellent right up until the part where I forgot it existed for nine days. The API returned 503 Service Unavailable, which I feel is the most honest status code a dying plant has ever produced. We are both recovering. Version 2 will add webhooks so it can text me before it gives up.
root@naomislivko:~/articles# cat comments
No comments yet — be the first.