DevNet Associate (DEVASC) v1.0Understanding and Using APIsMedium
A developer is designing an application that needs to receive real-time notifications about changes to a device's configuration without continuously polling the API. Which API-related mechanism would best achieve this requirement?
- ASOAP services
- BWebhooks
- CLong polling
- DBasic API calls
Show answer & explanationAnswer & explanation
Correct answer: B. Webhooks
Webhooks are designed for real-time, event-driven communication, where the API server pushes notifications to a configured URL when specific events occur, eliminating the need for constant polling.
Why the other options are wrong
- A. SOAP services are an older, XML-based protocol and do not inherently provide a push mechanism like webhooks for real-time notifications.
- C. Long polling reduces frequent polling but still involves the client initiating a request and waiting for a response, not true server-initiated push.
- D. Basic API calls require the client to initiate each request, which is not suitable for real-time push notifications.
Webhook
An HTTP POST callback delivered to a user-defined URL when an event occurs in a source system, enabling real-time notifications.
- Provides real-time, event-driven communication.
- Server-side pushes data to a client-configured endpoint.
- Eliminates the need for constant polling by the client.
Memory trick: Real-time Needs Instant Updates, Webhooks Deliver.