200-901 Question 25
Single answerYou are working on a Python script to automate the configuration of a network device using a RESTCONF API. After making changes to the running configuration, you realize the changes need to be committed to avoid being reverted. Which of the following steps should you take to ensure the changes are permanently applied?
- A
Send a POST request to the '/commit' endpoint.
- B
Send a PATCH request to the '/running-config/commit' endpoint.
- C
Send a POST request to the '/restconf/operations/commit' endpoint.
- D
Send a DELETE request to the '/candidate-config' endpoint.
Show answer and explanation
Correct answer: C
Explanation
Committing changes in RESTCONF typically involves invoking a specific operation provided by the API. In this case, the '/restconf/operations/commit' endpoint is used with a POST request to ensure that the changes are applied permanently. Understanding the correct HTTP methods and endpoints is critical when working with RESTCONF APIs in network automation.
- A. Incorrect.
RESTCONF does not use a '/commit' endpoint. This is not a valid action for committing changes.
- B. Incorrect.
PATCH requests are typically used to modify or update resources but are not used for committing changes. This endpoint is also invalid.
- C. Correct.
In RESTCONF, committing changes is performed by sending a POST request to the '/restconf/operations/commit' endpoint. This is the correct way to apply changes permanently.
- D. Incorrect.
Deleting the '/candidate-config' endpoint would discard any uncommitted changes, not commit them. This is the opposite of what is required.