Error Handling API Workflow
Call an API with TryCatch error handling and email notification on failure
Steps
| # | Activity | What it does |
|---|---|---|
| 1 | TryCatch | Wrap API call in error handler |
| 2 | HttpRequest | Call the API (inside try block) |
| 3 | WriteLine | Log success (inside try block) |
| 4 | WriteLine | Log error (inside catch block) |
| 5 | SMTPEmail | Send error notification (inside catch block) |
Workflow
try:
apiResponse = HttpRequest("https://api.example.com/data", "GET")
WriteLine(apiResponse)
except Exception as errorMessage:
WriteLine(errorMessage)
SMTPEmail("ops@example.com", emailBody=errorMessage, emailSubject="API Error Alert")