NETCONF needs an SSH session and XML messages.
RESTCONF gives you the same YANG data through a REST API.RESTCONF is a protocol that reads and changes YANG data with HTTP methods.
It runs over HTTPS, on TCP port 443.
Figure 1 - RESTCONF Runs over HTTPS
On Cisco IOS XE, two commands enable RESTCONF:
R1(config)#ip http secure-server R1(config)#restconfAnswer the question below
Which TCP port does RESTCONF use?
RESTCONF uses the HTTP methods that you already know:
GET reads data.
POST creates data.
PUT creates or replaces data.
PATCH updates data.
DELETE removes data.

Figure 2 - A Request and Its Response
RESTCONF has no hello message and no session.
Each request is independent.Answer the question below
Which method reads data?
The URL tells the router which data you want.
It follows the YANG model.
Figure 3 - The Parts of a RESTCONF URL
Read the URL in Figure 3 from left to right:
https://r1 is the router.
/restconf/data is the start of all the data.
ietf-interfaces:interfaces is the module and its container.
interface=GigabitEthernet0%2F1 is one entry of the list, selected by its name.
The interface name contains a slash.
In a URL, you must write this slash as %2F.Answer the question below
Which YANG module does this URL name?
This request reads all the interfaces:
GET https://r1/restconf/data/ietf-interfaces:interfaces Accept: application/yang-data+jsonThe Accept header asks for JSON.
To get XML, the value is application/yang-data+xml.The router sends this response:
HTTP/1.1 200 OK Content-Type: application/yang-data+json { "ietf-interfaces:interfaces": { "interface": [ { "name": "GigabitEthernet0/1", "description": "WAN", "type": "iana-if-type:ethernetCsmacd", "enabled": true } ] } }Read the response in three steps:
200 OK means that the request worked.
The first key starts with ietf-interfaces, the name of the module.
The content follows the ietf-interfaces model.
When your script sends JSON, it includes Content-Type: application/yang-data+json.
After a PATCH that works, the router sends 204 No Content, with no body.Answer the question below
Which status code shows that the GET worked?
Both protocols use the same YANG models.

Figure 4 - NETCONF and RESTCONF
Choose the protocol that fits your need:
Use NETCONF when you need sessions, datastore locking, or the candidate datastore with commit.
Use RESTCONF when your tools already use REST APIs and JSON.
Answer the question below
Which protocol can send JSON: NETCONF or RESTCONF?