Assess API version with Spring Boot Actuator

Production-ready endpoints are key to observability. Most java developers are aware of Spring Boot actuator, but if you aren’t, don’t’ worry! Here’s a great write up on the subject. Also, official documentation from Spring‘s is worth a read to understand.

And unless you have a well-planned API versioning by following URL versioning or Accept-Header versioning (interesting list of resources to decide on best approach here), you can easily tell whether an endpoint is serving the intended set of changes by leveraging source-control data, exposed conveniently by actuator endpoint.

I’ve just pushed to GitHub a minimal tool called api-version that uses curl, jq, and the Spring Boot Actuator to give you the exact commit message and id to contrast against your git repo. You’ll be able to assess whether the expected changes are deployed to an instance in seconds.

Please leave your comments here, or feel free to report any issues to the GitHub repo as well.

References:

Spring Boot Actuator: https://www.tutorialspoint.com/spring_boot/spring_boot_actuator.htm

Official Spring Boot Actuator example: https://spring.io/guides/gs/actuator-service/

Discussion on API versioning strategies: https://developers.redhat.com/blog/2016/06/13/api-versioning-methods-a-brief-reference/

API Versioning tool: https://github.com/rbuitragoc/api-version