350-401 Automation Practice Question
A network engineer is writing a Python script to retrieve the operational state of all GigabitEthernet interfaces from a Cisco IOS XE device using RESTCONF. The device is configured with HTTPS and the engineer has valid credentials. The script uses the 'requests' library to send a GET request to the RESTCONF API. Which HTTP header must be included in the request to specify that the client expects JSON-formatted data in the response?
⚠ Common exam trap
It's easy for candidates to confuse the Accept header, which specifies the desired response format, with the Content-Type header, which describes the request body format.
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
✓
Accept: application/yang-data+json
To retrieve JSON-formatted data from a RESTCONF API on Cisco IOS XE, the client must include the Accept header with the value 'application/yang-data+json'. This media type is defined by RFC 8040 for RESTCONF and ensures the server returns the response in JSON according to the YANG model. The Content-Type header is only for request bodies, and 'application/json' is not the correct media type for RESTCONF.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Accept: application/json
Why it's wrong here
While 'application/json' is a common media type, RESTCONF specifically uses 'application/yang-data+json' to indicate YANG-modeled data in JSON. Using 'application/json' may cause the server to reject the request or return an error because it does not match the RESTCONF media type requirements. Thus, it is incorrect for this scenario.
- ✗
Content-Type: application/json
Why it's wrong here
This header specifies the format of the request body, which is not applicable for a GET request. It does not inform the server about the desired response format. The engineer needs to set the Accept header, not Content-Type, to request JSON output. Hence, this option is wrong.
- ✗
Content-Type: application/yang-data+json
Why it's wrong here
The Content-Type header describes the media type of the request body, not the expected response. Since this is a GET request without a body, Content-Type is not used to specify response format. It would be relevant for POST or PUT requests. Therefore, it does not control the response format here.
- ✓
Accept: application/yang-data+json
Why this is correct
This header tells the RESTCONF server that the client expects the response body in JSON format according to the YANG data model. Cisco IOS XE RESTCONF uses the media type 'application/yang-data+json' for JSON-encoded YANG data. Without it, the server may return XML or an error. This is the correct header to include.
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
One of 1,923 original 350-401 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Cisco exam blueprint
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.