A RESTFul health check
- I'm interested in building verifications into a REST service to help with service monitoring, where I can verify properties about resources, and I'd like to know if there's any prior art or best practices people can recommend. For example, a service might look like:
which would respond with an error unless 5 new posts had been created in the past hour, thus indicating the system might not be operating correctly and is in need of further manual investigation. A service like this would allow me to use any standard HTTP service monitoring tool or hosted service (such as Pingdom) to report a warning should the call fail, and it's flexible enough to support multiple checks of this nature (e.g., http://example.com/posts/verify?min-comments=100&since=1-day-ago).
As for the response, I feel the appropriate content would be an indication of correctness along with the actual value ("All good! 20 posts were created in the past hour" or the equivalent in the requested content type.) Pragmatically, it's important to respond with different codes for success and failure. 200 seems fine for success, but I'm not sure what codes would make the most sense for a failed verification?