Summary
Overview
This course session focuses on troubleshooting and validating a financial account workflow involving customer record creation, passbook generation, and account closure, with emphasis on API interactions, environment configuration, and error handling. The instructor guides learners through debugging a failing workflow in Postman, identifying logical errors (e.g., infinite loops due to duplicate requests), correcting data structure issues (e.g., improper use of ID vs. email as primary key), and implementing delays to prevent resource exhaustion. The session includes live debugging, environment setup, collection sharing, and workflow validation for both account opening and closing operations.
Topic (Timeline)
1. Workflow Overview and Business Logic [00:00:01.860 - 00:01:55.980]
- Introduced the core workflow: customer record creation → passbook creation → display; for account closure: passbook termination → customer termination.
- Emphasized dependency order: customer cannot be terminated before its associated passbook.
- Highlighted need for error logging at each step (customer creation, passbook creation).
- Noted that learners are on Day 12 of training; instructed lunch break and encouraged completion of training survey afterward.
2. Workflow Validation and Environment Setup [00:04:51.840 - 00:06:54.940]
- Confirmed completion of GitHub/CICD workflow tasks; no outstanding issues.
- Identified critical data model error:
IDwas being used as a primary identifier, but should be a generated handler;emailorusernamemust serve as the true primary key. - Directed learners to verify environment configurations for API endpoints and data structures.
3. API Debugging and Request Flow Analysis [00:07:01.660 - 00:15:20.880]
- Walked through a failed account creation flow: POST request to create customer → POST to create passbook → returned 400 error.
- Identified incorrect endpoint usage; instructed learners to mouseover and copy the correct API URL from environment settings.
- Emphasized checking collection variables and ensuring no trailing spaces in URLs.
- Required learners to share their Postman collection for collaborative debugging.
- Instructed to make workspace public temporarily to allow instructor to fork and inspect.
4. Code and Collection Correction [00:16:05.780 - 00:20:30.740]
- Instructor forked learner’s workspace to diagnose issue.
- Discovered that string values in workflow were improperly formatted without double quotes (
""), causing execution failure. - Corrected code structure: ensured all string literals in Postman environment or request body were properly enclosed.
- Verified corrected workflow now executes successfully for customer and passbook creation.
5. Database Reset and End-to-End Workflow Testing [00:20:37.380 - 00:26:59.160]
- Flashed (cleared) database to ensure clean state before testing.
- Confirmed sequence: create customer → create passbook → get customer → get passbook.
- Noted high transaction volume in workflow; recommended adding delays (5–10 seconds) between steps to prevent Postman resource exhaustion.
- Observed intermittent failures due to rapid sequential requests; advised pacing to mimic real-world latency.
6. Infinite Loop Detection and Root Cause Analysis [00:29:09.080 - 00:34:43.440]
- Identified duplicate customer creation requests triggering an infinite loop.
- Confirmed learner sent two identical requests to the same endpoint, causing system overload and unexpected data duplication (e.g., customer funds appearing erroneously).
- Corrected logic: only one customer creation request should occur per workflow; subsequent steps must reference existing record via email, not re-create.
- Reinforced design principle: avoid redundant calls to the same endpoint within a single workflow.
7. Account Closure Workflow Design and Testing [00:38:13.740 - 00:41:26.080]
- Defined close account workflow: retrieve customer/passbook → delete passbook → delete customer.
- Contrasted with open account workflow: create customer → create passbook → retrieve.
- Flashed database again to reset state before testing closure flow.
- Instructed learner to implement and test close account sequence; confirmed need to restart Postman instance for clean execution.
Appendix
Key Principles
- Primary Key Rule: Use
emailorusernameas primary identifier, not auto-generatedID. - Dependency Order: Always terminate child resources (passbook) before parent (customer).
- Error Handling: Log failures at every step; never proceed silently on 4xx/5xx responses.
- Resource Management: Introduce delays (5–10s) between sequential API calls to avoid rate limiting or tool exhaustion.
Tools Used
- Postman for API testing and collection management
- GitHub for workflow versioning
- Environment-specific endpoints (custom URLs with variables)
- Database reset/flash for state cleanup
Common Pitfalls
- Using generated
IDas primary key instead ofemail - Sending duplicate requests to same endpoint → infinite loop
- Missing quotes around string values in Postman request body
- No delays between high-frequency requests → resource exhaustion
- Not verifying environment variables before execution
Practice Suggestions
- Rebuild the entire open/close workflow from scratch using corrected structure.
- Test each step individually before chaining.
- Share collections publicly for peer/instructor review.
- Always reset database before testing new flows.
- Validate response codes and payloads before proceeding to next step.