300-435 · Question #138
300-435 Question #138: Real Exam Question with Answer & Explanation
Sign in or unlock 300-435 to reveal the answer and full explanation for question #138. The question stem and answer options stay visible for context.
Question
Refer to the exhibit. A network engineer developed a script to automate the method to retrieve a list of network devices that are deployed to an enterprise. When the script is executed, it fails to retrieve the list of devices. Which action resolve the issue? ```python 1 def network_device_list(apic, ticket, id=None): 2 3 # Use the REST API to retrieve the list of network devices. 4 # If a device id is provided, return only that device 5 6 url = "https://{}/api/v1/network-device".format(apic) 7 headers = {"X-auth-token": " " + ticket} 8 9 # Change URL to single device given an id 10 if id: 11 url += "/{}".format(id) 12 13 # Make API request and return the response body 14 response = requests.request("PUT", url, headers=headers, verify=False) 15 16 # Always return a list object, even if single device for consistency 17 if id: 18 return [response.json()] ["response"] 19 20 return response.json() ["response"] ```
Options
- AChange PUT to GET.
- BChange PUT to DELETE.
- CChange PUT to POST.
- DChange PUT to PATCH.
Unlock 300-435 to see the answer
You've previewed enough free 300-435 questions. Unlock 300-435 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.