Lab: Build API Client with Token Refresh & Async Polling
Objectives
- Create Python API client library that handles OAuth2 authentication, token refresh, pagination, rate limiting, and async operation polling.
Prerequisites
VCF lab environment deployed and operational
Lab Environment
Standard VCF lab environment for Advanced VCF 9.0 Automation
Tasks
Task 1 Lab: Build API Client with Token Refresh & Async Polling
Create Python API client library that handles OAuth2 authentication, token refresh, pagination, rate limiting, and async operation polling.
Create VCFAutomationClient class with authenticate() method
Implement auto token refresh in get_headers()
Add api_request() wrapper that handles HTTP 429 with exponential backoff
Implement paginate() method for bulk listing
Add submit_deployment() method that returns request ID
Implement poll_request_status() with 10-minute timeout and 5s poll interval
Test with real VCF Automation instance: deploy blueprint, poll until completion
Verify token refresh happens at 55-minute mark (before 1hr expiry)
Validation Gate
Check: Verify lab completion
Expected: Lab exercise completed successfully
Common Errors
Final Validation
Lab completed successfully
✓ All steps completed → No errors observed
Cleanup / Restore
• Revert to snapshot if needed
Design Reflection (VCDX)
API integration skills demonstrate automation maturity. VCDX designs with programmatic management show scalability beyond UI-driven operations.