300-435 Question 84
Select 4You are tasked with configuring a Cisco device using RESTCONF API to update the hostname of the device. Using Python's requests library, which steps are necessary to successfully perform this operation?
- A
Send a POST request to the RESTCONF base URL with the updated hostname in the request body.
- B
Include the
Content-Type: application/yang-data+jsonheader in the HTTP request. - C
Authenticate the RESTCONF request using basic authentication with the device's username and password.
- D
Use the
PUTHTTP method to send the updated hostname to the appropriate RESTCONF URI. - E
Ensure the RESTCONF API is enabled and properly configured on the device before making the request.
Show answer and explanation
Correct answers: B, C, D, E
Explanation
To configure a Cisco device using RESTCONF API, you must ensure the device is properly set up to accept RESTCONF requests, authenticate the request, and use the correct HTTP method (PUT) with appropriate headers (Content-Type: application/yang-data+json) and request body. The POST method is not applicable for updating resources like the hostname.
- A. Incorrect.
POST is not the correct HTTP method for updating an existing resource like the hostname. PUT is used for this purpose.
- B. Correct.
The
Content-Type: application/yang-data+jsonheader ensures the request is understood as JSON-formatted data, which is required for RESTCONF communication. - C. Correct.
RESTCONF typically requires basic authentication or other authentication mechanisms to authorize API requests.
- D. Correct.
PUT is the correct HTTP method to update a resource like the hostname in RESTCONF.
- E. Correct.
RESTCONF must be enabled and configured on the device for any RESTCONF API operations to succeed.