300-435 Question 85
Select 4You are tasked with configuring a Cisco network device using the RESTCONF API and the Python requests library. Your goal is to update the hostname of the device. After importing the necessary Python libraries, which steps should you implement to achieve this?
- A
Set the RESTCONF URL endpoint to include the base URL, port, and the RESTCONF resource path for the hostname.
- B
Use the HTTP GET method in the requests library to modify the hostname resource.
- C
Include the updated hostname data in JSON format in the HTTP request's body.
- D
Set the 'Content-Type' HTTP header to 'application/yang-data+json'.
- E
Authenticate using the device's RESTCONF credentials in the requests method.
Show answer and explanation
Correct answers: A, C, D, E
Explanation
To configure a Cisco device using the RESTCONF API and Python requests library, you must provide the correct URL endpoint, include the updated data in the request body in JSON format, set the appropriate Content-Type header, and authenticate the request. The HTTP GET method is not applicable for modifying resources, making it an incorrect choice.
- A. Correct.
Correct: The RESTCONF URL endpoint should include the base URL, port, and resource path to target the desired configuration element, such as the hostname.
- B. Incorrect.
Incorrect: The HTTP GET method is used to retrieve data, not modify it. To update a resource, the HTTP PATCH or PUT method should be used.
- C. Correct.
Correct: To modify the hostname, the updated data must be included in the HTTP request's body in a supported format such as JSON.
- D. Correct.
Correct: Setting the 'Content-Type' header to 'application/yang-data+json' ensures the RESTCONF API interprets the data format correctly.
- E. Correct.
Correct: RESTCONF API requires authentication using valid credentials to authorize the request.