nerdexam
Cisco

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.

Controller-Based Network Automation

Question

Which Python snippet receives a Meraki webhook request?

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)
  • A
    2% (1)
  • B
    4% (2)
  • D
    94% (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.

A@app.route('/mynet/webhook', methods=['PUT']) @app.accept_body(WebhookSchema) def receive_webhook(*kwargs): send_sms_alert(kwargs['alertType'])

The PUT method is typically used for completely replacing a resource, which is not the method webhooks use to send event notifications.

B@app.route('/mynet/webhook', methods=['GET']) @app.accept_body(WebhookSchema) def receive_webhook(*kwargs): send_sms_alert(kwargs['alertType'])

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.

C@app.route('/mynet/webhook', methods=['PATCH']) @app.accept_body(WebhookSchema) def receive_webhook(*kwargs): send_sms_alert(kwargs['alertType'])

The PATCH method is used to apply partial modifications to a resource, which does not align with the standard way webhooks transmit event data.

D@app.route('/mynet/webhook', methods=['POST']) @app.accept_body(WebhookSchema) def receive_webhook(*kwargs): send_sms_alert(kwargs['alertType'])Correct

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

#Webhooks#HTTP POST#Python#API Integration

Community Discussion

No community discussion yet for this question.

Full 300-435 Practice