CCNA Restconf Questions

22 questions · Restconf topic · All types, answers revealed

1
Drag & Dropmedium

Drag and drop the following steps into the correct order to send a RESTCONF GET request to retrieve interface configuration from a Cisco IOS-XE device and apply a configuration change based on the response.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4

Why this order

The correct workflow is to first retrieve the current configuration with a GET request, then analyze the response to understand what changes are needed, create the updated payload in JSON or XML, and finally apply the change using PUT or PATCH.

Exam trap

Do not confuse the order of operations: you must retrieve the current configuration before analyzing or modifying it. The GET request is always the first step in a read-modify-write workflow.

2
PBQhard

You are connected to R1 (192.168.1.1/24, GigabitEthernet0/0). Using RESTCONF, you need to retrieve the operational status of interface GigabitEthernet0/0 and then change its description to 'Uplink to R2'. The correct base URI is https://192.168.1.1/restconf. Provide the GET and PATCH request URIs, required HTTP headers, and identify the error that occurs if you use Accept: application/json instead of application/yang-data+json.

Hints

  • RESTCONF base URI is always /restconf on Cisco IOS-XE.
  • The ietf-interfaces module is used for standard interface configuration; Cisco-IOS-XE-native is for native CLI-like data.
  • Content-type and Accept headers must match the YANG data format (application/yang-data+json).
A.GET /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0?content=nonconfig, PATCH /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0, Accept: application/yang-data+json, error: 406 Not Acceptable
B.GET /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0, PATCH /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0, Accept: application/json, error: 404 Not Found
C.GET /restconf/data/Cisco-IOS-XE-native:interface/GigabitEthernet0/0?content=nonconfig, PATCH /restconf/data/Cisco-IOS-XE-native:interface/GigabitEthernet0/0, Accept: application/yang-data+json, error: 406 Not Acceptable
D.GET /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0?content=nonconfig, PATCH /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0, Accept: application/json, error: 404 Not Found
AnswerA
solution
! R1
GET URI: /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0?content=nonconfig
PATCH URI: /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0
Headers: Accept: application/yang-data+json, Content-Type: application/yang-data+json (for PATCH)
PATCH body: {"ietf-interfaces:interface": [{"name": "GigabitEthernet0/0", "description": "Uplink to R2"}]}
Wrong Accept: application/json causes 406 Not Acceptable
Wrong YANG path (e.g., /restconf/data/Cisco-IOS-XE-native:interface) causes 404 Not Found

Why this answer

The correct GET URI is /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0?content=nonconfig to retrieve operational status. The PATCH URI is /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0 with a JSON body containing the new description. Both requests require the header Accept: application/yang-data+json.

If Accept: application/json is used, the router returns a 406 Not Acceptable error because IOS-XE RESTCONF only accepts application/yang-data+json. The YANG module path must use the ietf-interfaces module name; using a wrong path like /restconf/data/Cisco-IOS-XE-native:interface/GigabitEthernet0/0 would return a 404 Not Found.

Exam trap

Remember that RESTCONF requires the specific media type application/yang-data+json, not generic application/json. Also, operational data retrieval requires the ?content=nonconfig query parameter. Using the wrong YANG module path leads to a 404 error, while the wrong Accept header leads to 406.

Why the other options are wrong

B

The specific factual error: The GET URI is missing ?content=nonconfig, and the Accept header should be application/yang-data+json. The error for wrong Accept is 406, not 404.

C

The specific factual error: The YANG module path should be ietf-interfaces:interfaces/interface=..., not Cisco-IOS-XE-native:interface/.... The error for wrong path is 404, not 406.

D

The specific factual error: The Accept header must be application/yang-data+json; application/json is not acceptable and returns 406, not 404.

3
Multi-Selectmedium

Which THREE statements accurately describe the characteristics of NETCONF and RESTCONF for programmatic network configuration?

Select 3 answers
A.NETCONF uses HTTP methods such as GET, POST, PUT, and DELETE to manipulate configuration data.
B.NETCONF uses XML-encoded RPCs over a secure transport such as SSH or TLS.
C.RESTCONF supports both XML and JSON encoding and uses HTTP methods.
D.Both NETCONF and RESTCONF rely on YANG data models to define the structure of configuration and operational data.
E.NETCONF uses a separate commit operation to apply changes, while RESTCONF uses a similar commit mechanism.
AnswersB, C, D

NETCONF encodes operations in XML and sends them as RPCs over a secure connection (SSH or TLS). This is a core characteristic of NETCONF.

Why this answer

NETCONF uses XML-encoded Remote Procedure Calls (RPCs) over a secure transport such as SSH or TLS, making option B correct. RESTCONF supports both XML and JSON encoding and uses standard HTTP methods (GET, POST, PUT, PATCH, DELETE), so option C is correct. Both NETCONF and RESTCONF rely on YANG data models to define the structure of configuration and operational data, confirming option D.

Option A is incorrect because NETCONF does not use HTTP methods; that is a characteristic of RESTCONF. Option E is wrong because RESTCONF does not use a separate commit operation; changes are applied immediately with each HTTP request, unlike NETCONF's candidate config and commit model.

Exam trap

Cisco often tests the misconception that NETCONF uses HTTP methods like RESTCONF, leading candidates to incorrectly select option A as a correct statement about NETCONF.

Why the other options are wrong

A

NETCONF uses XML‑encoded RPCs over SSH or TLS, not HTTP methods; HTTP methods are used by RESTCONF.

E

RESTCONF does not have a separate commit operation; changes are applied immediately with each HTTP request, unlike NETCONF's explicit commit step.

4
PBQhard

You are connected to R1 (198.51.100.1/24). Using RESTCONF, you need to retrieve the current operational status of GigabitEthernet0/0/0 via the ietf-interfaces YANG model, then update its description to 'WAN-Link-to-R2' using a PATCH request with the Cisco-IOS-XE-native YANG model. The candidate must identify the correct base URI, YANG module path, HTTP headers (Accept: application/yang-data+json), interpret the JSON response, and recognize the error that occurs when an incorrect Content-Type header or wrong YANG path is used.

Network Topology
G0/0/0198.51.100.1/24G0/0/0198.51.100.2/24EthernetR1R2

Hints

  • The ietf-interfaces model provides operational data; configuration changes require Cisco-IOS-XE-native.
  • The Content-Type header must be application/yang-data+json for PATCH requests.
  • URL-encode special characters like '/' in interface names as '%2F'.
A.GET request to /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0/0 with Accept: application/yang-data+json; PATCH request to /restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=0/0/0 with Content-Type: application/yang-data+json and body {"Cisco-IOS-XE-native:description": "WAN-Link-to-R2"}
B.GET request to /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0/0 with Accept: application/json; PATCH request to /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0/0 with Content-Type: application/yang-data+json and body {"description": "WAN-Link-to-R2"}
C.GET request to /restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=0/0/0 with Accept: application/yang-data+json; PATCH request to /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0/0 with Content-Type: application/json and body {"description": "WAN-Link-to-R2"}
D.GET request to /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0/0 with Accept: application/yang-data+json; PATCH request to /restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=0/0/0 with Content-Type: application/json and body {"Cisco-IOS-XE-native:description": "WAN-Link-to-R2"}
AnswerA
solution
! R1
Use GET: curl -k -u admin:cisco -H "Accept: application/yang-data+json" https://198.51.100.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0%2F0%2F0
Use PATCH: curl -k -u admin:cisco -X PATCH -H "Content-Type: application/yang-data+json" -d '{"Cisco-IOS-XE-native:description":"WAN-Link-to-R2"}' https://198.51.100.1/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=GigabitEthernet0%2F0%2F0/description

Why this answer

The GET request correctly uses the ietf-interfaces YANG path and Accept header to retrieve the interface operational data. The PATCH request fails because it attempts to modify 'description' under the ietf-interfaces model, which is read-only for operational data; the writable 'description' is under Cisco-IOS-XE-native:native/interface/GigabitEthernet. The correct PATCH URI targets the Cisco-IOS-XE-native YANG module path, and the Content-Type must be application/yang-data+json.

The 400 error indicates a mismatch between the YANG path in the URI and the data payload.

Exam trap

A common trap is confusing operational (read-only) and configuration (writable) YANG models. Remember that ietf-interfaces provides operational data, while Cisco-IOS-XE-native provides configuration data. Also, ensure the correct Content-Type header is used for write operations.

Why the other options are wrong

B

The specific factual error is that the ietf-interfaces model's operational data cannot be modified via PATCH; the writable description is under Cisco-IOS-XE-native. Also, the Accept header should be application/yang-data+json.

C

The specific factual error is that the GET request should use ietf-interfaces for operational data, and the PATCH request should use the native model with correct Content-Type.

D

The specific factual error is that the Content-Type header must be application/yang-data+json, not application/json, to indicate the payload is YANG-encoded JSON.

5
Multi-Selectmedium

Which two statements about YANG are correct?

Select 2 answers
A.It defines structured models for configuration and state data
B.It is commonly associated with NETCONF and RESTCONF
C.It is a replacement for OSPF adjacency formation
D.It is the same thing as JSON syntax
E.It automatically discovers neighbors on a LAN
AnswersA, B

That is the core purpose of YANG.

Why this answer

YANG is a data modeling language used to describe configuration and operational state. It is commonly used with NETCONF and RESTCONF, but it is not itself the transport protocol.

Exam trap

A common exam trap is mistaking YANG for a routing protocol or a data format. Some candidates incorrectly believe YANG replaces protocols like OSPF for adjacency formation or that it is the same as JSON syntax. This confusion arises because YANG models can be encoded in JSON or XML, but YANG itself is a modeling language, not a transport or routing protocol.

Misunderstanding this can lead to selecting incorrect answers that describe YANG as performing routing or neighbor discovery functions, which it does not. Recognizing YANG’s role as a data modeling language avoids this pitfall.

Why the other options are wrong

C

Option C is incorrect because YANG is not a routing protocol and does not handle OSPF adjacency formation or any routing functions.

D

Option D is incorrect as YANG is a modeling language, not a data format like JSON. Although YANG models can be encoded in JSON, they are not the same thing.

E

Option E is incorrect because YANG does not perform network discovery functions such as automatically discovering neighbors on a LAN; that is outside its scope.

6
Drag & Dropmedium

Drag and drop the following steps into the correct order to retrieve the operational status of interface GigabitEthernet0/0 using NETCONF and the ietf-interfaces YANG model.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4
5Step 5
6Step 6

Why this order

First, establish an SSH connection to the device's NETCONF subsystem (TCP port 830). The NETCONF protocol then performs a capability exchange via <hello> messages to ensure both sides support the required YANG models. Next, a <get> RPC with an XPath filter is sent to request the specific interface status.

The server replies with <rpc-reply> containing the XML data. The client parses the XML to extract the desired value. Finally, the NETCONF session is closed by a <close-session> RPC, and the SSH connection is terminated.

This order ensures a proper NETCONF transaction lifecycle.

7
Matchingmedium

Drag and drop the YANG, NETCONF, and RESTCONF terms on the left to their correct descriptions on the right.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

A data modeling language used to define the structure of configuration and state data for network devices

A protocol that uses XML and SSH to transport configuration and state data between a client and a network device

A protocol that uses HTTP methods (GET, PUT, POST, DELETE) to access YANG-defined data on a network device

A file that defines the schema, including data types, groupings, and constraints for network configuration

A node in a YANG data model that groups related leaf nodes and other containers together

A NETCONF operation used to modify the configuration of a network device

Why these pairings

YANG is the modeling language, NETCONF uses XML RPCs over SSH, RESTCONF uses HTTP and YANG models. The pairs match each term to its core function.

Exam trap

Be careful not to confuse the roles of YANG, NETCONF, and RESTCONF. YANG is a modeling language, not a protocol. NETCONF uses SSH and XML, while RESTCONF uses HTTP and supports JSON/XML.

Many candidates mistakenly attribute HTTP/JSON to NETCONF or SSH to RESTCONF.

8
Drag & Dropmedium

Drag and drop the following steps into the correct order to retrieve a specific interface's configuration via RESTCONF and apply a change to the interface description.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4

Why this order

First retrieve the config, parse it, modify the description, apply the change, then verify.

Exam trap

The key trap is confusing the order of operations: you must retrieve before modifying, and apply before verifying. Candidates often mix up the sequence, especially placing verification too early or modification before retrieval.

9
MCQhard

Why are data models such as YANG important in network automation?

A.They define a structured way to represent configuration and state data
B.They replace IPv4 and IPv6 addressing
C.They remove the need for routing protocols
D.They are used only for naming wireless SSIDs
AnswerA

Correct. Structured data models are foundational to automation workflows.

Why this answer

Data models such as YANG standardize how configuration and operational data are described, which improves consistency for automation systems and APIs.

Exam trap

A common exam trap is to mistakenly believe that YANG data models replace fundamental network functions such as IPv4/IPv6 addressing or routing protocols. Some candidates incorrectly assume that because YANG structures configuration data, it eliminates the need for routing protocols like OSPF or EIGRP, or that it changes how IP addresses function. However, YANG is strictly a modeling language that describes how configuration and state data are represented for automation purposes.

It does not alter core networking protocols or addressing schemes. Confusing these roles can lead to selecting incorrect answers that misattribute YANG’s purpose.

Why the other options are wrong

B

Option B is incorrect because YANG does not replace IPv4 or IPv6 addressing schemes. IP addressing remains a core network function independent of data modeling languages.

C

Option C is wrong since YANG does not remove the need for routing protocols. Routing protocols like OSPF and EIGRP continue to operate and are configured using data models but are not replaced by them.

D

Option D is false because YANG’s scope is much broader than naming wireless SSIDs. It models a wide range of network configurations and operational data beyond wireless settings.

10
PBQhard

You are connected to R1. Using RESTCONF, you need to retrieve the current IP address of interface GigabitEthernet0/0 using the ietf-interfaces YANG model, then change it to 192.0.2.1/24 using a PATCH request. The device is reachable at 10.1.1.1 with port 443 and credentials admin/cisco. Identify the correct URIs and required HTTP headers, and explain why a GET with Accept: application/json would fail.

Network Topology
G0/010.0.0.1/30G0/010.0.0.2/30linkR1R2

Hints

  • RESTCONF requires the media type application/yang-data+json in Accept and Content-Type headers.
  • The ietf-interfaces YANG module path for an interface is /ietf-interfaces:interfaces/interface=<name>.
  • The Cisco-IOS-XE-native module uses a different hierarchy; using it for ietf-interfaces data will result in a 404 error.
A.GET https://10.1.1.1:443/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0 with Accept: application/yang-data+json; PATCH same URI with Content-Type: application/yang-data+json and body {"ietf-interfaces:interface":{"name":"GigabitEthernet0/0","ipv4":{"address":[{"ip":"192.0.2.1","netmask":"255.255.255.0"}]}}}
B.GET https://10.1.1.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0 with Accept: application/json; PATCH same URI with Content-Type: application/json and body {"interface":{"ip":"192.0.2.1","mask":"255.255.255.0"}}
C.GET https://10.1.1.1:443/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=0/0/ip/address with Accept: application/yang-data+json; PATCH same URI with Content-Type: application/yang-data+json and body {"address":{"primary":{"address":"192.0.2.1","mask":"255.255.255.0"}}}
D.GET https://10.1.1.1:443/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0 with Accept: application/xml; PATCH same URI with Content-Type: application/xml and body <interface><ipv4><address><ip>192.0.2.1</ip><netmask>255.255.255.0</netmask></address></ipv4></interface>
AnswerA
solution
! R1
GET URI: https://10.1.1.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0
Request headers: Accept: application/yang-data+json
PATCH URI: https://10.1.1.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0
PATCH headers: Content-Type: application/yang-data+json, Accept: application/yang-data+json
PATCH body: { "ietf-interfaces:interface": { "name": "GigabitEthernet0/0", "ipv4": { "address": [ { "ip": "192.0.2.1", "netmask": "255.255.255.0" } ] } } }

Why this answer

The correct base URI for RESTCONF is /restconf/data. The YANG path uses /ietf-interfaces:interfaces/interface=GigabitEthernet0/0. The Accept header must specify application/yang-data+json; generic application/json causes a 406 error.

For PATCH, the same URI is used with Content-Type: application/yang-data+json. Crucially, the PATCH body must contain the key leaf 'name' ('GigabitEthernet0/0') inside the container to identify the list instance per RFC 8040; omitting it can cause failure. A wrong YANG path like Cisco-IOS-XE-native would yield 404.

Exam trap

The key trap is that RESTCONF does not accept generic application/json; it requires application/yang-data+json. Many candidates mistakenly use application/json and expect it to work. Also, ensure the YANG path matches the specified model (ietf-interfaces) and that the JSON body follows the YANG data hierarchy.

Why the other options are wrong

B

The specific factual error: RESTCONF mandates the use of application/yang-data+json for Accept and Content-Type headers; application/json is not supported. Also, the JSON body must follow the YANG data structure.

C

The specific factual error: The question explicitly requires the ietf-interfaces YANG model, not the Cisco-native model. Using the wrong model will not retrieve or modify the intended data.

D

The specific factual error: The question context indicates JSON is the target format (since it mentions Accept: application/json would fail). Using XML is a different format and would require different media types.

11
PBQhard

You are connected to R1 (192.168.1.1). Using RESTCONF, you need to retrieve the current operational status of GigabitEthernet0/0 using the ietf-interfaces YANG module, then change its description to 'WAN Link to R2' via a PATCH request. The device is reachable via HTTPS on port 443, with credentials admin/admin. Identify the correct base URI, YANG path, HTTP headers, and interpret the JSON response. Also, diagnose the error when an incorrect Content-Type or YANG path is used.

Network Topology
G0/0192.168.1.1/30G0/0192.168.1.2/30linkR1R2

Hints

  • RESTCONF base URI always starts with /restconf
  • The ietf-interfaces module uses 'interface' as list node, not 'interfaces-state'
  • The correct media type for YANG data in JSON is application/yang-data+json
A.Base URI: https://192.168.1.1/restconf, YANG path: /data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0, Accept: application/yang-data+json, PATCH body: {"ietf-interfaces:description": "WAN Link to R2"}
B.Base URI: https://192.168.1.1/restconf, YANG path: /data/ietf-interfaces:interfaces-state/interface=GigabitEthernet0/0, Accept: application/yang-data+json, PATCH body: {"description": "WAN Link to R2"}
C.Base URI: https://192.168.1.1/restconf, YANG path: /data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0, Accept: application/json, PATCH body: {"description": "WAN Link to R2"}
D.Base URI: https://192.168.1.1/restconf, YANG path: /data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0, Accept: application/yang-data+json, PATCH body: {"description": "WAN Link to R2"}
AnswerA
solution
! R1
GET URI: https://192.168.1.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0
GET Headers: Accept: application/yang-data+json
PATCH URI: https://192.168.1.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0
PATCH Headers: Content-Type: application/yang-data+json, Accept: application/yang-data+json
PATCH Body: {"ietf-interfaces:interface": [{"name": "GigabitEthernet0/0", "description": "WAN Link to R2"}]}
Error 1: Using Accept: application/json returns 406 Not Acceptable
Error 2: Using Content-Type: application/json returns 415 Unsupported Media Type
Error 3: Using YANG path /data/ietf-interfaces:interfaces-state returns 404 Not Found (operational state, not config)

Why this answer

The correct RESTCONF base URI is https://192.168.1.1/restconf. For the ietf-interfaces module, the YANG path for an interface is /data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0. The required Accept header is application/yang-data+json.

A PATCH request to change just the description must include the module prefix in the JSON key: {"ietf-interfaces:description": "WAN Link to R2"}. Using application/json for Content-Type returns a 415 Unsupported Media Type error. Using the wrong YANG path (e.g., /data/ietf-interfaces:interfaces-state) returns a 404 Not Found because that path is for operational state, not configurable data.

Exam trap

Watch out for the need to include the YANG module prefix (ietf-interfaces:) in JSON keys for RESTCONF PATCH requests, even for individual leaves. Also, differentiate between configuration data (/data) and operational state (/data/...-state) paths.

Why the other options are wrong

B

The specific factual error is that interfaces-state is an operational data node, not configurable. RESTCONF requires the /data path for configuration and /operations for RPCs.

C

The specific factual error is that RESTCONF requires the media type application/yang-data+json for JSON encoding of YANG data, not generic application/json.

D

The specific factual error is that in RESTCONF, when modifying data from a specific YANG module, the JSON key must include the module prefix to avoid ambiguity.

12
PBQhard

You are connected to R1 (192.0.2.1/24, management IP). The network team needs to automate interface configuration using RESTCONF. Construct a valid RESTCONF GET request to retrieve the operational status of GigabitEthernet0/1 using the ietf-interfaces YANG module, and a PATCH request to set the description of that interface to 'Link to R2' using the Cisco-IOS-XE-native YANG module. Identify the error that occurs if the Accept header is set to application/json instead of application/yang-data+json.

Network Topology
G0/0192.0.2.1/24G0/010.0.0.2/30G0/1 (10.0.0.1/30)R1R2

Hints

  • RESTCONF uses a specific media type for YANG data; check the Accept header.
  • The YANG module paths differ between ietf-interfaces and Cisco-IOS-XE-native.
  • The interface name must be URL-encoded if it contains special characters; GigabitEthernet0/1 is safe.
A.The server returns a 406 Not Acceptable error because RESTCONF requires the Accept header to be 'application/yang-data+json'.
B.The server returns a 400 Bad Request error because the Accept header must be 'application/json' for RESTCONF.
C.The server returns a 415 Unsupported Media Type error because the Accept header is set incorrectly.
D.The server returns a 200 OK response but ignores the Accept header and returns data in XML format.
AnswerA
solution
! R1
GET request: GET https://192.0.2.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/1 HTTP/1.1
Headers: Host: 192.0.2.1, Accept: application/yang-data+json
PATCH request: PATCH https://192.0.2.1/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=0/1/description HTTP/1.1
Headers: Host: 192.0.2.1, Content-Type: application/yang-data+json, Accept: application/yang-data+json
Body: {"description": "Link to R2"}

Why this answer

The correct base URI for RESTCONF on Cisco IOS-XE is https://<device-ip>/restconf/data. For the ietf-interfaces module, the YANG path is /ietf-interfaces:interfaces/interface=GigabitEthernet0%2F1 (note the percent-encoded slash in the key). For the Cisco-IOS-XE-native module, the path is /Cisco-IOS-XE-native:native/interface/GigabitEthernet=0%2F1/description.

The Accept header must be 'application/yang-data+json'; using 'application/json' returns a 406 Not Acceptable error. The PATCH request body must contain the new description in JSON format. Failing to percent-encode the interface name will result in an invalid URI.

Exam trap

The exam tests your knowledge of RESTCONF media types and URL encoding: remember to percent-encode the slash in interface names (e.g., GigabitEthernet0%2F1) and distinguish between 406 (Accept error) and 415 (Content-Type error).

Why the other options are wrong

B

The specific factual error: RESTCONF requires 'application/yang-data+json', not 'application/json'.

C

The specific factual error: 415 relates to Content-Type, not Accept. Accept errors yield 406.

D

The specific factual error: RESTCONF does not silently fall back; it returns a 406 error.

13
Multi-Selecthard

A controller exposes a YANG-modeled interface configuration through an API. Which two statements correctly describe the purpose of YANG in that workflow?

Select 2 answers
A.It provides a structured data model for configuration and operational data
B.It helps standardize how network elements represent managed data
C.It replaces IP addressing on routed interfaces
D.It is a spanning-tree optimization mechanism
AnswersA, B

YANG defines how data is organized and described.

Why this answer

YANG is a modeling language. It defines the structure of network data so controllers and devices can exchange information consistently through APIs such as RESTCONF or NETCONF.

Exam trap

A frequent exam trap is mistaking YANG for a network protocol or function rather than a data modeling language. For example, options suggesting YANG replaces IP addressing or optimizes spanning-tree protocols are incorrect because YANG does not perform routing or Layer 2 operations. Candidates might confuse YANG’s role with actual network services instead of recognizing it as a schema that defines how configuration and state data are structured and exchanged.

This misunderstanding can lead to selecting incorrect answers that describe network functions rather than data modeling purposes.

Why the other options are wrong

C

Option C is incorrect because YANG does not replace IP addressing on routed interfaces. IP addressing is a network-layer function, while YANG models the data representing such configurations but does not perform addressing itself.

D

Option D is wrong as YANG has no role in spanning-tree optimization or Layer 2 loop prevention. YANG is a data modeling language and does not influence protocol operations like STP.

14
MCQmedium

A network engineer is automating the configuration of a new branch office router. The engineer needs a protocol that uses a YANG data model, supports both configuration and operational state retrieval, and operates over SSH for secure transport. Which protocol should the engineer use?

B.NETCONF
C.RESTCONF
D.CLI scripting
AnswerB

NETCONF uses YANG data models, supports both configuration and operational state retrieval, and operates over SSH for secure transport. It is the ideal choice for automating network device configuration in a secure manner.

Why this answer

NETCONF (Network Configuration Protocol) is the correct choice because it uses YANG data models for configuration and operational state retrieval, and it operates over SSH (RFC 6242) for secure transport. Unlike SNMP, NETCONF provides transactional configuration changes and separates configuration from operational state data, making it ideal for automated router configuration.

Exam trap

Cisco often tests the distinction between NETCONF and RESTCONF, where the trap is that both use YANG, but candidates forget that NETCONF specifically requires SSH transport, while RESTCONF uses HTTP/HTTPS, making NETCONF the only correct answer when the question specifies 'operates over SSH'.

Why the other options are wrong

A

SNMP does not use YANG data models and typically operates over UDP, not SSH.

C

RESTCONF uses HTTP/HTTPS for transport, not SSH, so it does not meet the requirement of operating over SSH.

D

CLI scripting lacks a standardized data model like YANG and is not a protocol that operates over SSH in the same structured manner as NETCONF.

15
PBQhard

Which option performs the RESTCONF operations correctly?

Network Topology
G0/0192.168.1.1/30G0/0192.168.1.2/30linkR1R2

Hints

  • Check the YANG module path: ietf-interfaces vs Cisco-IOS-XE-native
  • Ensure the Accept header matches the data format (yang-data+json)
  • For PATCH, the Content-Type must be application/yang-data+json, not application/json
A.GET /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0 with Accept: application/yang-data+json; then PATCH same URI with Content-Type: application/yang-data+json and body {"ietf-interfaces:interface":{"duplex":"full"}}; expect 204 No Content.
B.GET /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0 with Accept: application/json; then PATCH same URI with Content-Type: application/json and body {"duplex":"full"}; expect 204 No Content.
C.GET /restconf/data/Cisco-IOS-XE-native:interface/GigabitEthernet0/0 with Accept: application/yang-data+json; then PATCH same URI with Content-Type: application/yang-data+json and body {"Cisco-IOS-XE-native:interface":{"duplex":"full"}}; expect 204 No Content.
D.GET /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0 with Accept: application/yang-data+json; then PATCH same URI with Content-Type: application/yang-data+json and body {"duplex":"full"}; expect 200 OK.
AnswerA
solution
! R1
GET request URI: /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0
GET headers: Accept: application/yang-data+json
PATCH request URI: /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0
PATCH headers: Content-Type: application/yang-data+json
PATCH body: {"ietf-interfaces:interface": {"duplex": "full"}}

Why this answer

The correct base URI for RESTCONF is /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0. The Accept header must be application/yang-data+json. If the Content-Type header is incorrect (e.g., application/json), the router will return a 415 Unsupported Media Type error.

Using the wrong YANG module path, such as Cisco-IOS-XE-native:interface/GigabitEthernet0/0, will result in a 404 Not Found because the data model does not match. After a successful GET, the PATCH request must include the same URI with Content-Type: application/yang-data+json and a JSON body specifying "duplex": "full". The response should be a 204 No Content if successful.

Exam trap

Watch out for the required media type: RESTCONF uses application/yang-data+json, not generic application/json. Also, the YANG path must match the data model; for standard interface settings, use ietf-interfaces, not Cisco-IOS-XE-native. Finally, remember that a successful PATCH returns 204 No Content, not 200 OK.

Why the other options are wrong

B

The specific factual error is that RESTCONF requires the media type application/yang-data+json for YANG data, not generic application/json.

C

The specific factual error is that the duplex setting is defined in the ietf-interfaces YANG model, not in Cisco-IOS-XE-native. The URI path must match the data model.

D

The specific factual errors are: (1) The PATCH body must be structured as {"ietf-interfaces:interface":{"duplex":"full"}} to match the YANG data tree; (2) The success response for PATCH is 204 No Content, not 200 OK.

16
Drag & Dropmedium

Drag and drop the following steps into the correct order to sequence the actions an automation system performs when automating the remediation of a network configuration drift detected via NETCONF/YANG.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4

Why this order

The automation system first detects the drift, then analyzes and plans remediation, executes the fix, and finally verifies the change.

Exam trap

This question tests your understanding of the logical sequence in automated remediation workflows. A common trap is to think that analysis or execution might come before detection, but detection is always the first step in any monitoring-based automation. Remember: you can't fix what you haven't detected.

17
PBQhard

You are connected to R1 (192.0.2.1/24). Use RESTCONF to query the operational state of GigabitEthernet0/0 using the ietf-interfaces YANG module. Then, send a PATCH request to disable the interface (set 'enabled' to false) using the Cisco-IOS-XE-native YANG module. Identify the error when a PATCH request is sent with the wrong Content-Type header (application/json instead of application/yang-data+json) and when the PATCH URI uses an incorrect YANG path (ietf-interfaces instead of Cisco-IOS-XE-native).

Hints

  • RESTCONF requires Content-Type: application/yang-data+json for write operations.
  • The ietf-interfaces module is read-only for operational state; use Cisco-IOS-XE-native for configuration changes.
  • Check the URI path: /restconf/data/ followed by the YANG module and container/leaf.
A.The PATCH request fails with a 415 Unsupported Media Type error because the Content-Type header must be application/yang-data+json, not application/json.
B.The PATCH request fails with a 404 Not Found error because the URI uses ietf-interfaces, which is a read-only module for operational state; the server cannot write to it.
C.The PATCH request succeeds but the interface is not disabled because the body must use 'shutdown' instead of 'enabled'.
D.The PATCH request fails with a 400 Bad Request error because the body must be XML, not JSON.
AnswerA
solution
! R1
GET /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0 --header 'Accept: application/yang-data+json'
PATCH /restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=0/0 --header 'Content-Type: application/yang-data+json' -d '{"Cisco-IOS-XE-native:interface":{"GigabitEthernet":[{"name":"0/0","shutdown":true}]}}'

Why this answer

The correct GET request uses the ietf-interfaces YANG module path to retrieve interface state. For the PATCH, the Cisco-IOS-XE-native module is used because it supports writing native configuration (including shutdown). Sending PATCH with Content-Type: application/json is rejected because RESTCONF requires application/yang-data+json.

Using ietf-interfaces in the PATCH URI fails because that module is read-only for operational state; the server returns 404 or 405. The correct PATCH body sets 'shutdown' to true within the native interface container.

Exam trap

The trap is that candidates may focus on the YANG module path error (ietf-interfaces vs Cisco-IOS-XE-native) and miss that the question explicitly asks about the error when the Content-Type header is wrong. Always read the question carefully to identify the specific condition being tested.

Why the other options are wrong

B

The specific factual error is that the question asks about the error when the Content-Type header is wrong, not the URI path. The URI path error is a separate issue.

C

The specific factual error is that a wrong Content-Type header causes a rejection before any body parsing, so the request does not succeed.

D

The specific factual error is that RESTCONF does accept JSON; the issue is the exact media type string, not the format.

18
PBQmedium

You are connected to R1 via the console. R1 is a Cisco ISR 4321 router running IOS-XE. The network manager wants to monitor interface utilization changes. Use RESTCONF to retrieve the operational state of GigabitEthernet0/0/0 on R1. The device has RESTCONF enabled with username 'admin' and password 'cisco'. The management IP is 192.168.1.1.

Hints

  • RESTCONF uses HTTPS on port 443 by default.
  • The interface name in the URI must be URL-encoded (e.g., '/' becomes '%2F').
  • Use the 'Accept' header to request JSON data.
A.curl -X GET -u admin:cisco https://192.168.1.1/restconf/data/ietf-interfaces:interfaces-state/interface=GigabitEthernet0%2F0%2F0
B.curl -X GET -u admin:cisco https://192.168.1.1/restconf/data/ietf-interfaces:interfaces/GigabitEthernet0/0/0
C.curl -X POST -u admin:cisco https://192.168.1.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0%2F0%2F0
D.curl -X GET -u admin:cisco https://192.168.1.1/restconf/data/Cisco-IOS-XE-interfaces-oper:interfaces/GigabitEthernet0/0/0
AnswerA
solution
! R1
curl -k -X GET https://192.168.1.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0%2F0%2F0 -u admin:cisco -H "Accept: application/yang-data+json"

Why this answer

RESTCONF uses GET to retrieve data. To retrieve operational state (including interface counters), the path must lead to the `interfaces-state` container, not `interfaces`. The correct YANG data model for operational interface state is `ietf-interfaces:interfaces-state`, and the interface name must be URL-encoded to replace slashes with `%2F`.

Option C uses POST, which is wrong. Option B lacks URL encoding and uses the config container. Option D uses a Cisco-specific module and unencoded slashes, and is not the standard operational state path.

Exam trap

The most common mistake is using the `ietf-interfaces:interfaces` configuration container instead of the `ietf-interfaces:interfaces-state` operational state container, causing retrieval of the running configuration rather than live interface counters and utilization.

Why the other options are wrong

B

The request uses unencoded slashes in the interface name and the configuration container `interfaces`, not `interfaces-state`, so it will not retrieve operational state.

C

RESTCONF uses GET for retrieval; POST is used to create new resources or invoke operations, not to read operational data.

D

This uses a Cisco-IOS-XE-specific module and unencoded slashes, while the task expects the standard ietf-interfaces operational state path.

19
Drag & Dropmedium

Drag and drop the following steps into the correct order to retrieve the current OSPF configuration via RESTCONF and apply a change to the OSPF process ID on a Cisco IOS-XE device.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4

Why this order

First, send a GET request to retrieve the current OSPF configuration. Then parse the JSON/XML payload to identify the OSPF process ID. Next, modify the OSPF process ID in the payload.

Finally, send a PUT or PATCH request to apply the change.

Exam trap

Do not assume that modification or update is the first step. RESTCONF operations require a read-modify-write sequence. Always start with a GET to retrieve the current configuration.

20
Drag & Dropmedium

Drag and drop the following steps into the correct order to retrieve a specific interface configuration via RESTCONF and apply a change to the interface description.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4

Why this order

Retrieve the current interface config, parse it, modify the description, apply the update, and verify the change.

Exam trap

The trap is that all steps are valid actions, but the question asks for the correct order. Candidates must recognize that retrieval (GET) must come before modification (PUT), and verification (another GET) comes after the update.

21
PBQhard

You are connected to R1 (10.0.0.1/30). You need to use RESTCONF to verify the current administrative status of interface GigabitEthernet0/1 on R1, then change it to 'down'. The YANG data model is ietf-interfaces, and the base URI is https://10.0.0.1/restconf. Provide the correct GET and PATCH request URIs with appropriate HTTP headers. Also identify what error would occur if you used 'application/xml' as the Accept header or if you used the path 'Cisco-IOS-XE-native:native/interface/GigabitEthernet' instead of the correct ietf-interfaces path.

Hints

  • The ietf-interfaces module uses 'enabled' leaf (true/false) for admin status.
  • The interface name must be URL-encoded (e.g., GigabitEthernet0%2F1).
  • Using 'Cisco-IOS-XE-native' path for operational state will not return the admin status.
A.GET https://10.0.0.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/1 with Accept: application/yang-data+json; PATCH same URI with Content-Type: application/yang-data+json and body {"ietf-interfaces:interface": {"enabled": false}}; using Accept: application/xml gives 406 Not Acceptable; using Cisco-IOS-XE-native path gives 404 or incorrect data.
B.GET https://10.0.0.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/1 with Accept: application/xml; PATCH same URI with Content-Type: application/xml and body <interface><enabled>false</enabled></interface>; using Accept: application/xml is fine; using Cisco-IOS-XE-native path gives same data.
C.GET https://10.0.0.1/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet0/1 with Accept: application/yang-data+json; PATCH same URI with Content-Type: application/yang-data+json and body {"Cisco-IOS-XE-native:interface": {"enabled": false}}; using Accept: application/xml gives 406; using ietf-interfaces path gives 404.
D.GET https://10.0.0.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/1 with Accept: application/json; PATCH same URI with Content-Type: application/json and body {"interface": {"enabled": false}}; using Accept: application/xml gives 406; using Cisco-IOS-XE-native path gives 404.
AnswerA
solution
! R1
GET https://10.0.0.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/1
Accept: application/yang-data+json
PATCH https://10.0.0.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/1
Content-Type: application/yang-data+json
{
  "ietf-interfaces:interface": {
    "enabled": false
  }
}

Why this answer

The correct GET request URI is: GET https://10.0.0.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/1 with Accept: application/yang-data+json. The correct PATCH request URI is the same, with Content-Type: application/yang-data+json and a JSON body {"ietf-interfaces:interface": {"enabled": false}}. Using Accept: application/xml would result in a 406 Not Acceptable error because the server only supports yang-data+json.

Using the Cisco-IOS-XE-native path would return a 404 or incorrect data because the operational state of the interface (admin status) is modeled under ietf-interfaces, not under the native YANG model which is used for configuration only.

Exam trap

The trap is that candidates may confuse the YANG models (ietf-interfaces vs. native) and the required media types. Remember that operational state is under ietf-interfaces, and RESTCONF on Cisco IOS XE uses application/yang-data+json, not XML or generic JSON.

Why the other options are wrong

B

The specific factual error is that Cisco IOS XE RESTCONF implementation does not support XML content type; it only supports JSON.

C

The specific factual error is that the admin status is not available under the native YANG model; it is under ietf-interfaces.

D

The specific factual error is that RESTCONF requires the media type application/yang-data+json, not generic application/json. Additionally, the module name prefix is required in the JSON body.

22
PBQhard

You are connected to R1. Use RESTCONF to retrieve all operational interface statistics from the ietf-interfaces YANG module, then modify the description of GigabitEthernet0/1 to 'Link to R2 via RESTCONF' using a PATCH request. The device is reachable at 203.0.113.1 with port 443, username 'admin', password 'cisco123'. Identify the error that would occur if you used a PATCH with Content-Type: application/json instead of application/yang-data+json.

Network Topology
G0/0203.0.113.1/24InternetR1RESTCONF client

Hints

  • RESTCONF base URI is always /restconf.
  • Use the YANG module 'ietf-interfaces' for operational state and configuration.
  • The correct media type for RESTCONF is application/yang-data+json, not generic application/json.
A.The server returns a 415 Unsupported Media Type error because RESTCONF requires the Content-Type header to be application/yang-data+json.
B.The server returns a 400 Bad Request error because the JSON payload is malformed when using application/json.
C.The server returns a 404 Not Found error because the URI is incorrect when using application/json.
D.The server returns a 204 No Content response but ignores the description change because application/json is not supported.
AnswerA
solution
! R1
GET https://203.0.113.1/restconf/data/ietf-interfaces:interfaces-state/interface
Accept: application/yang-data+json
PATCH https://203.0.113.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/1
Content-Type: application/yang-data+json
{"ietf-interfaces:interface": [{"name": "GigabitEthernet0/1", "description": "Link to R2 via RESTCONF"}]}

Why this answer

The correct base URI for RESTCONF is https://203.0.113.1/restconf. To retrieve operational interface statistics, use GET with the path /data/ietf-interfaces:interfaces-state/interface. For the PATCH to modify the description, the URI must target /data/ietf-interfaces:interfaces/interface=GigabitEthernet0/1 with a JSON payload containing the 'description' leaf.

The required Content-Type and Accept headers must be 'application/yang-data+json'. Using 'application/json' will result in a 415 Unsupported Media Type error because RESTCONF requires the specific YANG media type.

Exam trap

The exam tests your knowledge of RESTCONF's strict media type requirements. Many candidates assume that application/json is acceptable because it is common in REST APIs, but RESTCONF specifically requires 'application/yang-data+json'. Remember that using any other media type results in a 415 error.

Why the other options are wrong

B

The specific factual error is that a 400 Bad Request is not triggered by an incorrect Content-Type; it is triggered by malformed syntax or invalid data.

C

The specific factual error is that the Content-Type header does not affect resource discovery; it only affects how the server interprets the payload.

D

The specific factual error is that an unsupported media type results in a client error (4xx), not a success response (2xx).

Ready to test yourself?

Try a timed practice session using only Restconf questions.