300-435 · Question #39
Which Python snippet receives a Meraki webhook request?
The correct answer is D. @app.route('/mynet/webhook', methods=['POST']) @app.accept_body(WebhookSchema) def receive_webhook(*kwargs): send_sms_alert(kwargs['alertType']). To receive Meraki webhook requests, a Python application must define a route that specifically listens for and accepts HTTP POST methods, as this is the standard way webhooks transmit data.
Question
Options
- A@app.route('/mynet/webhook', methods=['PUT']) @app.accept_body(WebhookSchema) def receive_webhook(*kwargs): send_sms_alert(kwargs['alertType'])
- B@app.route('/mynet/webhook', methods=['GET']) @app.accept_body(WebhookSchema) def receive_webhook(*kwargs): send_sms_alert(kwargs['alertType'])
- C@app.route('/mynet/webhook', methods=['PATCH']) @app.accept_body(WebhookSchema) def receive_webhook(*kwargs): send_sms_alert(kwargs['alertType'])
- D@app.route('/mynet/webhook', methods=['POST']) @app.accept_body(WebhookSchema) def receive_webhook(*kwargs): send_sms_alert(kwargs['alertType'])
How the community answered
(54 responses)- A2% (1)
- B4% (2)
- D94% (51)
Why each option
To receive Meraki webhook requests, a Python application must define a route that specifically listens for and accepts HTTP POST methods, as this is the standard way webhooks transmit data.
The PUT method is typically used for completely replacing a resource, which is not the method webhooks use to send event notifications.
The GET method is used to retrieve data from a server and is not suitable for receiving webhook payloads, which are sent in the request body.
The PATCH method is used to apply partial modifications to a resource, which does not align with the standard way webhooks transmit event data.
Webhooks, including those from Meraki, typically deliver event notifications using HTTP POST requests, with the payload embedded in the request body. Therefore, the Python snippet must define a route that specifically handles `methods=['POST']` to correctly receive and process Meraki webhook requests.
Concept tested: Receiving HTTP POST Meraki webhooks
Source: https://developer.cisco.com/meraki/api-v1/#!get-network-webhooks-http-servers
Topics
Community Discussion
No community discussion yet for this question.