Case Study: API Automation with URI¶
Section status: outline
This case study is scoped but not yet written in full prose. The sections below define what it will cover.
Problem¶
Every newly deployed host needs to register itself with an internal service registry over HTTP as the last step of provisioning, and deregister cleanly on decommission.
What It Will Cover¶
ansible.builtin.urifor both the registrationPOSTand a decommissionDELETE, full example building on URI and API Automationretries/untilfor a registry that's occasionally briefly unavailable, instead of failing the whole deploy on one transient blip- Structured error handling:
failed_whenchecking the JSON response body's own status field, not just the HTTP status code no_logon the registration token, and confirming with-vvvit never surfaces
Interview Questions¶
- How would you make an API-registration task resilient to a brief, transient outage of the target service?
- Why check the response body's own status field in addition to the HTTP status code?
Next¶
Continue to Troubleshooting.