RESTCONF Examples
This section provides several restAction examples. Sample input values are used to illustrate the Reference variable you would enter for each Incoming Variable on the task dialog.
GET
This example provides information on NSO for the device name C-IOS1.
Variable: adapterId
"Local NSO"
Variable: params
{
"path": "/restconf/data/tailf-ncs:devices/device=C-IOS1",
"contentType": "application/yang-data+json",
"accept": "application/yang-data+json",
"method": "GET"
}
Variable: body
{ }
PATCH
This example adds an interface config to the C-IOS1 device.
Variable: adapterId
"Local NSO"
Variable: params
{
"path": "/restconf/data/tailf-ncs:devices/device=C-IOS1/config",
"accept": "application/yang-data+json",
"contentType": "application/yang-data+json",
"method": "PATCH“
}
Variable: body
{
"config": {
"tailf-ned-cisco-ios:interface": {
"Loopback": [
{
"name": "1",
"ip": {
"address": {
"primary": {
"address": "127.0.0.1",
"mask": "255.0.0.0"
}
}
}
}
]
}
}
}
PUT
This example updates an interface config to the C-IOS1 device.
Variable: adapterId
"Local NSO"
Variable: params
{
"path": "/restconf/data/tailf-ncs:devices/device=C-IOS1/config/tailf-ned-cisco-ios:interface/Loopback=1/ip",
"accept": "application/yang-data+json",
"contentType": "application/yang-data+json",
"method": "PUT“
}
Variable: body
{
"ip": {
"address": {
"primary": {
"address": "127.0.0.2",
"mask": "255.0.0.0"
}
}
}
}
POST
This example creates a device on NSO named C-IOS1.
Variable: adapterId
"Local NSO"
Variable: params
{
"path": "/restconf/data/tailf-ncs:devices",
"contentType": "application/yang-data+json",
"accept": "application/yang-data+json",
"method": "POST“
}
Variable: body
{
"tailf-ncs:device": {
"name": “C-IOS1",
"address": "127.0.0.1",
"port": 10022,
"authgroup": "default",
"device-type": {
"cli": {
"ned-id": "cisco-ios-cli-6.23:cisco-ios-cli-6.23"
}
}
}
}
DELETE
This example deletes the C-IOS1 device.
Variable: adapterId
"Local NSO"
Variable: params
{
"path": "/restconf/data/tailf-ncs:devices/device=C-IOS1",
"accept": "application/yang-data+json",
"contentType": "application/yang-data+json",
"method": “DELETE“
}
Variable: body
{ }
Automation Examples
Depicted below is an example workflow (automation) using RESTCONF to:
- Onboard a device.
- Perform a
fetch-ssh-keyaction. - Perform a
sync-fromaction. - Delete a device.
Figure 1: RESTCONF Workflow

Add Device
This sample illustrates the Variables used to add a device.
Figure 2: RESTCONF Add Device

Fetch SSH Keys
This sample illustrates the Variables used to fetch-host-keys in a device.
Figure 3: RESTCONF Fetch Host Keys

Sync-From
This sample illustrates the Variables used to sync-from a device.
Figure 4: RESTCONF Sync-From

Delete Device
This sample illustrates the Variables used to delete a device.
Figure 5: RESTCONF Delete Device

Service Model Example
The Variables pictured below illustrate how to apply a Service Model using the commit-queue tag with optional features for optimization (i.e., no-out-of-sync-check, continue-on-error).
Figure 6: RESTCONF Service Model Input

Figure 7: RESTCONF Service Model Output
