nerdexam
Cisco

300-435 · Question #153

Refer to the exhibit. A network engineer creates a Python script to retrieve event messages from Cisco vManage by using the Cisco Catalyst SD-WAN vManage API. After the messages are retrieved, they…

The correct answer is B. Correct the link to the requested resource. A Python JSONDecodeError indicates the HTTP response body is not valid JSON, which is caused by an incorrect resource URL returning an error page or non-JSON content.

Controller-Based Network Automation

Question

Refer to the exhibit. A network engineer creates a Python script to retrieve event messages from Cisco vManage by using the Cisco Catalyst SD-WAN vManage API. After the messages are retrieved, they are adapted to interact with network devices and sent to a Slack chatbot for further processing by engineers. After the script is run, a Python JSONDecodeError message is received. Which action resolves the issue?

Options

  • ASpecify the values of the variables that refer to the metrics.
  • BCorrect the link to the requested resource.
  • CUse pagination with the query.
  • DChange the authentication credentials.

How the community answered

(30 responses)
  • A
    10% (3)
  • B
    73% (22)
  • C
    13% (4)
  • D
    3% (1)

Why each option

A Python JSONDecodeError indicates the HTTP response body is not valid JSON, which is caused by an incorrect resource URL returning an error page or non-JSON content.

ASpecify the values of the variables that refer to the metrics.

Unspecified metric variable values would cause a Python NameError or KeyError, not a JSONDecodeError during response parsing.

BCorrect the link to the requested resource.Correct

When the URL path to the vManage API resource is incorrect, the server returns an HTML error page or a non-JSON error response instead of the expected JSON payload. Calling response.json() on such a response triggers a JSONDecodeError because the content cannot be parsed as JSON. Correcting the URL to point to the proper API endpoint ensures a valid JSON response is returned.

CUse pagination with the query.

Pagination issues would result in truncated or partial data but would still return valid JSON - they would not cause a JSONDecodeError.

DChange the authentication credentials.

Incorrect authentication credentials would return an HTTP 401 response, which vManage returns as JSON - this would not cause a JSONDecodeError.

Concept tested: Diagnosing JSONDecodeError from incorrect API URL

Source: https://developer.cisco.com/docs/sdwan/

Topics

#API Troubleshooting#JSONDecodeError#Cisco vManage API#Python Scripting

Community Discussion

No community discussion yet for this question.

Full 300-435 Practice