DevNet Associate (DEVASC) v1.0Understanding and Using APIsMedium
A network operations team is integrating a new monitoring tool that needs to receive real-time alerts from a Cisco device's API whenever a specific event (e.g., interface status change) occurs. The monitoring tool does not continuously poll the device. Which API mechanism is best suited for the device's API to proactively notify the monitoring tool?
- AWebhooks configured on the device's API.
- BRESTful GET requests from the monitoring tool.
- CSMTP email notifications from the device.
- DPolling the device's API at regular intervals.
Show answer & explanationAnswer & explanation
Correct answer: A. Webhooks configured on the device's API.
Webhooks are an ideal mechanism for real-time, event-driven communication. When a specific event occurs on the Cisco device, its API can trigger an HTTP POST request to a pre-configured URL on the monitoring tool, providing immediate notification without continuous polling.
Why the other options are wrong
- B. GET requests are for retrieving data and require the client to initiate the request, which doesn't fit the 'proactive notification' requirement.
- C. While SMTP notifications are proactive, they are typically for human consumption and not a standard API mechanism for machine-to-machine real-time data transfer.
- D. Polling involves the client repeatedly checking for updates, which is inefficient and not real-time compared to webhooks.
Webhooks for Real-time Events
A webhook is an HTTP callback: an HTTP POST request triggered by an event, sent from a source application to a destination URL. They enable real-time communication between systems without continuous polling.
- Event-driven mechanism.
- Server-side sends data to client-side.
- Uses HTTP POST requests to a pre-configured URL.
- Eliminates the need for constant polling, reducing overhead.
Memory trick: Webhooks Watch for Events, then Notify.