350-901 · Question #75
Refer to the exhibit. Which RESTCONF verb changes the GigabitEthernet2 interface from 192.168.100.1/24 to 10.10.10.1/24? import json, requests USER = 'admin' PASS = 'cisco' url =…
The correct answer is B. PATCH. To modify an existing configuration attribute in RESTCONF, the PATCH HTTP method is used, as it applies partial updates to a resource.
Question
"/interface/GigabitEthernet=2/ip/address/primary" payload = {"primary": {"address": "10.10.10.1", "mask": "255.255.255.0"}} data = json.dumps(payload) headers = { 'Accept': "application/yang-data+json", 'Content-Type': "application/yang-data+json", } response = requests.request(" ", url, auth=(USER, PASS), data=data, headers=headers, verify=False) print(response.text)
Options
- APOST
- BPATCH
- CGET
- DHEAD
How the community answered
(67 responses)- A3% (2)
- B75% (50)
- C6% (4)
- D16% (11)
Why each option
To modify an existing configuration attribute in RESTCONF, the PATCH HTTP method is used, as it applies partial updates to a resource.
POST is used to create new resources or submit data to be processed, not to modify existing attributes of a resource.
The PATCH HTTP method is specifically designed for applying partial modifications to a resource, which is exactly what's needed when changing an existing IP address on an interface without replacing the entire interface configuration. RESTCONF leverages PATCH to update specific data nodes within a YANG data model.
GET is used to retrieve data from a resource, not to modify it.
HEAD is used to retrieve only the headers of a resource, similar to GET but without the response body.
Concept tested: RESTCONF HTTP methods for configuration updates
Source: https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/prog/configuration/171/b_171_programmability_cg/restconf_support.html#C_RESTCONF_VERBS
Topics
Community Discussion
No community discussion yet for this question.