Showing results for 
Search instead for 
Did you mean: 


Deleting multiple parts of interface configuration using Rest Conf

Apologies if it's been asked before, but I've search and can't find anything suitable.


Also, I'm very new to Rest Conf, so please bear with me


I've managed to pull in the switch interface config using the following:


GET https://{{host}}:{{port}}/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=1%2F0%2F19


Resulting in:


"Cisco-IOS-XE-native:GigabitEthernet": {
"name": "1/0/19",
"description": "something else",
"ip": {
"access-group": {
"in": {
"acl": {
"acl-name": "implicit_deny",
"in": [null]
"Cisco-IOS-XE-nbar:nbar": {
"protocol-discovery": {
"source": {
"template": {
"template-name": [
"template-name": "PORT-AUTH-TEMPLATE"
"Cisco-IOS-XE-lldp:lldp": {
"receive": false,
"transmit": false
"Cisco-IOS-XE-policy:service-policy": {
"input": "WEBUI-MARKING-IN",
"output": "WEBUI-QUEUING-OUT",
"type": {
"control": {
"subscriber": "PORT-AUTH-POLICY"
"Cisco-IOS-XE-spanning-tree:spanning-tree": {
"portfast": {
"Cisco-IOS-XE-switch:device-tracking": {
"attach-policy": "IPDT_MAX_10"


I know I can default the interface from the CLI and do a PUT with the above JSON to re-configure the interface.


And I've worked out how to delete the description for instance with:


DELETE  https://{{host}}:{{port}}/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=1%2F0%2F19/description



What I don't know if it's possible is to delete multiple parts of the config in one go, i.e. Send one DELETE Rest Conf to delete the description and ip access-group commands in one go.

Or, if I can default the interface using REST CONF.

If anyone can share some advice I'd appreciate it.

Thanks in advance,


Cisco Employee

I don't think you should need to default the interface first. If you do a PUT it should overwrite whatever is in place with what is in the PUT.


As an alternative, you could also look at using the YANG Patch media type for the RESTCONF request. A YANG Patch allows you to perform multiple actions within a single transaction in NSO, and they don't necessarily have to be the same type of action (so for example, you could delete the description and access-group from an interface and add a new BGP peer in a single RESTCONF command). It takes a little more effort to work out the correct data to send, but is a much more flexible way to implement changes.


To use a YANG Patch, you should send a PATCH request to /restconf/data with a Content-Type header of application/yang-patch+xml and an Accept header of application/yang-data+xml. Below is an example of a YANG Patch data body:



<yang-patch xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch">
      <Port-channel xmlns="urn:ios"  xmlns:ios="urn:ios"  xmlns:ncs="">
      <vrf xmlns="urn:ios"  xmlns:ios="urn:ios"  xmlns:ncs="">

This one request includes 2 merges and a delete to completely different parts of the device configuration, but NSO will treat this as a single transaction.



You can also find more details on YANG Patch in the relevant RFC, here