mediumMultiple Choice
350-401 Practice Question: Uses the Requests library to send a RESTCONF…
A network engineer uses the Requests library to send a RESTCONF PATCH request to modify the hostname of a Cisco IOS-XE device:
```python
import requests from requests.auth import HTTPBasicAuth
url = 'https://192.168.1.1/restconf/data/Cisco-IOS-XE-native:native/hostname' headers = {'Content-Type': 'application/yang-data+json'} auth = HTTPBasicAuth('admin', 'cisco123') payload = { 'Cisco-IOS-XE-native:hostname': 'NewRouter'
}
response = requests.patch(url, json=payload, headers=headers, auth=auth, verify=False)
print(response.status_code)
```
What is the expected HTTP status code if the request is successful?
⚠ Common exam trap
Cisco often tests the distinction between HTTP methods and their corresponding success codes, and the trap here is that candidates confuse PATCH with PUT (which returns 200 or 204) or POST (which returns 201), leading them to incorrectly select 200 OK or 201 Created.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
204 No Content
A successful RESTCONF PATCH request returns HTTP status code 204 No Content because the operation modifies an existing resource without returning a response body. The PATCH method in RESTCONF is used for partial updates to a target resource, and per RFC 8040, a 204 response indicates that the server has successfully applied the modifications and the response has no payload.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
200 OK
Why it's wrong here
HTTP 200 OK is the generic success code and is technically possible for RESTCONF PATCH only when the server includes the updated resource representation in the response body. However, the default and standard RESTCONF behavior for a successful PATCH is to return 204 No Content with an empty body. Because the exam asks for the standard response code, 200 OK is not the correct choice.
- ✗
201 Created
Why it's wrong here
201 Created is reserved for requests that create a new resource, such as a POST that adds a new data node to the datastore. PATCH is defined to modify an existing resource, and even if the patch inserts new child nodes, the targeted resource already exists, so no new resource is created. Therefore, 201 is semantically incorrect for a RESTCONF PATCH success.
- ✓
204 No Content
Why this is correct
204 No Content is the standard success response for a RESTCONF PATCH operation per RFC 8040. It tells the client that the server applied the patch successfully and that the response body is intentionally empty, avoiding unnecessary payload transfer. This makes 204 the correct answer for a successful RESTCONF PATCH.
- ✗
202 Accepted
Why it's wrong here
202 Accepted signals that the server has accepted the request for processing but has not yet completed it, which is typical for asynchronous tasks. A RESTCONF PATCH is synchronous: the server applies the edit immediately and responds 204 No Content when finished. Using 202 would leave the client uncertain whether the patch was actually applied, so it is not the standard RESTCONF success code.
Go deeper
Related to this question
Learn chapter
SDN Controllers and Cisco ACI
Key term
REST API for Network Devices
A REST API for network devices is a set of rules that allows software applications to communicate with routers, switches, and firewalls using standard web methods like GET, POST, PUT, and DELETE over HTTP or HTTPS.
Key term
NETCONF Protocol
NETCONF is a network management protocol that uses a structured data format to configure, retrieve, and modify network devices in a standard, programmatic way.
About these practice questions
Courseiva writes every 350-401 question from scratch — 1,923 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 350-401 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 350-401 exam.