Courseiva
mediumMultiple ChoiceObjective-mapped

200-901 Practice Question: A junior network developer is tasked with writing…

A junior network developer is tasked with writing a Python script that uses the Cisco NX-API to retrieve the current VLAN configuration from a Nexus switch. The script should output the VLAN IDs in a JSON format. The developer wrote the following code:

import requests
import json

url = "https://192.168.1.1/api/aaaLogin.json" payload = {"aaaUser":{"attributes":{"name":"admin","pwd":"cisco123"}}} r = requests.post(url, json=payload, verify=False) token = r.json()["imdata"][0]["aaaLogin"]["attributes"]["token"]

After authentication, the developer attempts to get VLANs using a GET request to "https://192.168.1.1/api/mo/sys/vlan.json" but receives a 401 error. Which of the following should the developer do to fix the issue?

⚠ Common exam trap

Cisco often tests the distinction between cookie-based authentication (used by NX-API and APIC) and token-based authentication (like Bearer tokens in OAuth2), leading candidates to incorrectly assume the token should go in the Authorization header.

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

Include the token in the cookie header

C is correct because Cisco NX-API uses cookie-based authentication, not bearer tokens. After a successful login via POST to /api/aaaLogin.json, the token must be included in the Cookie header (e.g., 'Cookie: APIC-cookie=' + token) for subsequent requests. Without this cookie, the GET request to retrieve VLANs is unauthorized, resulting in a 401 error.

Answer analysis

Option-by-option breakdown

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

  • Set the 'Authorization' header to 'Bearer ' + token

    Why it's wrong here

    Bearer token authentication is not used by NX-API; it expects a cookie.

  • Use a PUT request instead of GET

    Why it's wrong here

    Changing the method does not fix the authentication issue.

  • Include the token in the cookie header

    Why this is correct

    NX-API uses cookie-based authentication; the token must be sent as a cookie.

  • Use POST to retrieve VLANs

    Why it's wrong here

    POST is not idempotent and not appropriate for retrieving data; the issue is authentication.

Visual reference

Switch VLAN 10 Sales (192.168.10.0/24) PC-A PC-B VLAN 20 HR (192.168.20.0/24) PC-C PC-D Router VLANs isolate traffic — inter-VLAN routing requires a Layer 3 device

About these practice questions

This 200-901 question is part of Courseiva's 989-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 200-901 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 200-901 exam.