Courseiva
Question 1,941 of 1,840
hardMultiple ChoiceObjective-mapped

350-401 Practice Question: Uses the Requests library to query a Cisco IOS-XE…

A network engineer uses the Requests library to query a Cisco IOS-XE device via RESTCONF for interface statistics:

```python

import requests
from requests.auth import HTTPBasicAuth

url = 'https://192.168.1.1/restconf/data/Cisco-IOS-XE-interfaces-oper:interfaces/interface=GigabitEthernet1/0/1/statistics' headers = {'Accept': 'application/yang-data+json'} auth = HTTPBasicAuth('admin', 'cisco123') response = requests.get(url, headers=headers, auth=auth, verify=False)

print(response.json())

```

What is the most likely issue with this code?

⚠ Common exam trap

Candidates may overlook the requirement to URL-encode special characters like '/' in RESTCONF URIs and assume the code is correct, leading them to select superficially plausible but incorrect options such as A or C.

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

The interface name 'GigabitEthernet1/0/1' in the URL must be URL-encoded as 'GigabitEthernet1%2F0%2F1'.

The code contains an unencoded slash in the interface name 'GigabitEthernet1/0/1', which is a special character in RESTCONF URIs. It must be URL-encoded as 'GigabitEthernet1%2F0%2F1' to be correctly interpreted as a list key value. Therefore, option B correctly identifies the issue. Option A is false because the URL already includes '/restconf/data/'. Option C is incorrect because 'application/yang-data+json' is the proper Accept header for RESTCONF YANG data. Option D is false because GET is the correct HTTP method for data retrieval.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The URL is missing the '/data' segment; it should be '/restconf/data/...'

    Why it's wrong here

    The URL already includes the '/data' segment, so this is not missing.

  • The interface name 'GigabitEthernet1/0/1' in the URL must be URL-encoded as 'GigabitEthernet1%2F0%2F1'.

    Why this is correct

    The interface name 'GigabitEthernet1/0/1' contains a slash that must be URL-encoded; the code uses the unencoded form, causing the RESTCONF path to be misinterpreted.

  • The Accept header should be 'application/json' instead of 'application/yang-data+json'.

    Why it's wrong here

    The Accept header 'application/yang-data+json' is appropriate for receiving YANG-modeled data in JSON format from a RESTCONF server.

  • The HTTP method should be POST instead of GET.

    Why it's wrong here

    A GET request is correct for retrieving data; POST is used for creating or invoking operations.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jul 4, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.