nerdexam
Cisco

300-435 · Question #120

Refer to the exhibit. An engineer must split the network ENAUTO by using Cisco Meraki APIs. Which code snippet must be added to the box in the code to complete the Python code? import requests url =…

The correct answer is A. response = requests.request('POST', url, headers=headers, data = payload). This question identifies the correct HTTP method and Python requests library usage for splitting a Cisco Meraki network via its API.

Controller-Based Network Automation

Question

Refer to the exhibit. An engineer must split the network ENAUTO by using Cisco Meraki APIs. Which code snippet must be added to the box in the code to complete the Python code? import requests url = "https://api.meraki.com/api/v1/networks/ENAUTO/split" payload = None headers = { "Content-Type": "application/json", "Accept": "application/json", "X-Cisco-Meraki-API-Key": "6bec40cf957de430a6f1f2012345678a4f4ac9ea0" } print(response.text.encode('utf8'))

Exhibit

300-435 question #120 exhibit

Options

  • Aresponse = requests.request('POST', url, headers=headers, data = payload)
  • Bresponse = requests.request('PATCH', url, headers=headers, data = payload)
  • Cresponse = requests.request('PUT', url, headers=headers, data = payload)
  • Dresponse = requests.request('GET', url, headers=headers, payload = none)

How the community answered

(69 responses)
  • A
    80% (55)
  • B
    10% (7)
  • C
    3% (2)
  • D
    7% (5)

Why each option

This question identifies the correct HTTP method and Python `requests` library usage for splitting a Cisco Meraki network via its API.

Aresponse = requests.request('POST', url, headers=headers, data = payload)Correct

The Meraki API endpoint `/networks/{networkId}/split` is used to initiate the splitting of a combined network, which is an action that creates new resources or changes the state, making POST the appropriate HTTP method for this operation. The `requests.request()` function with 'POST' sends the request to the specified URL with the defined headers and payload.

Bresponse = requests.request('PATCH', url, headers=headers, data = payload)

PATCH is typically used to apply partial modifications to an existing resource, not to initiate a new action like splitting a network.

Cresponse = requests.request('PUT', url, headers=headers, data = payload)

PUT is generally used to completely replace an existing resource or create a resource if it does not exist, which is not the primary purpose of splitting a network.

Dresponse = requests.request('GET', url, headers=headers, payload = none)

GET is used solely to retrieve data from a server and should not be used for modifying or initiating actions on resources.

Concept tested: Meraki API HTTP methods, Python requests

Source: https://developer.cisco.com/meraki/api-v1/#!split-network

Topics

#Meraki API#Python requests#REST API#HTTP Methods

Community Discussion

No community discussion yet for this question.

Full 300-435 Practice