Scenario
You’re investigating API behavior for a web application that:- Makes authenticated API calls to
https://api.example.com - Uses JWT tokens for authentication
- Implements retry logic for failed requests
- Has CORS issues on some endpoints
Workflow
Start session and navigate to the app
Launch bdg and load the application. Network collection is enabled by default.Wait for the session to start and the page to load.
Filter for API requests only
Use the API preset to show only XHR and Fetch requests.Expected output:
Monitor API calls in real-time
Stream network requests as they happen using follow mode.Leave this running in one terminal while interacting with the app in another terminal or browser.
Inspect authentication headers
Check request and response headers for authentication issues.Expected output:Check if the
authorization header is present and properly formatted.Inspect CORS headers
Check CORS headers on failing cross-origin requests.Expected output:Common CORS issues:
- Missing
access-control-allow-originheader - Wildcard
*origin with credentials - Missing method in
access-control-allow-methods
Track retry attempts
If the app retries failed requests, identify the pattern.Expected output:This shows 2 failed attempts (500) followed by success (200).
Export API traffic as HAR file
Export all network data for analysis in external tools.Import the HAR file into Chrome DevTools or online HAR viewers for detailed analysis.
Filtering Patterns
Find large API responses
Track authentication refresh flow
Monitor WebSocket connections
Find cached vs fresh API calls
Common API Issues
401 Unauthorized - Expired JWT tokens
401 Unauthorized - Expired JWT tokens
429 Too Many Requests - Rate limiting
429 Too Many Requests - Rate limiting
Symptom: API calls fail after rapid requests.Investigation:
CORS preflight failures
CORS preflight failures
Symptom: OPTIONS requests fail before actual API call.Investigation:
Slow API responses
Slow API responses
Symptom: API calls take too long.Investigation:
Advanced Techniques
Correlate API calls with user actions
Run commands in sequence and track which API calls they trigger:Monitor API calls during form submission
Export API call summary
Automation Example
Script to monitor API health:Next Steps
Network List Command
Learn all network filtering options
HAR Export
Export network data in HAR format
Headers Inspection
Inspect HTTP request/response headers
Debugging SPAs
Correlate API calls with console errors

