QuestionQ204
Understanding and Using APIsDrag the code options from the bottom into the missing boxes to enable switch ports by using RESTCONF. Not every option is used.
Drag & Drop
yang-data+json
application/xml
ietf-interfaces:interface
iana-if-type:softwareLoopback
base_url
run_function
iana-if-type:ethernetCsmacd
def enable_function(if_name, if_status, if_type): headers = {'Accept': 'application/yang-data+json', 'Content-Type': 'application/'} payload = { "": { "name": if_name, "enabled": if_status, "type": if_type, } } = 'https://192.168.1.1:8443' restconf_url = '/restconf/data/ietf-interfaces:interfaces/interface' res = requests.put(f'{base_url}{restconf}={if_name}', headers=headers, json=payload, auth=('cisco', 'secret'), verify=False) enable_function('Loopback1', true, '')
Community Discussion