Skip to content
Topic: REST APIs & HTTPSwitch

6.0 Automation

REST APIs & HTTP Practice Questions

REST API fundamentals, HTTP methods/status codes, and Cisco DNA Center authentication.

One solved question, so you can see how these are marked

Which data serialization format relies on strict indentation (spaces, not tabs) and uses key-value pairs formatted with colons without curly brackets or trailing commas?

YAML

YAML uses whitespace indentation for structure and key-value mapping without requiring brackets or delimiters used by JSON/XML.

Every question in the set below is marked like this. The answers stay hidden until you pick one.

All 13 REST APIs & HTTP questions in this set

Answers and explanations appear when you work through the set above.

  1. Which HTTP verb is considered idempotent and is used to completely replace or create a target resource at a specific URI?

    • POST
    • PUT
    • PATCH
    • DELETE
  2. When authenticating to Cisco DNA Center REST APIs, which HTTP header must be included in subsequent requests after obtaining an authentication token?

    • Authorization: Bearer <token>
    • X-Auth-Token: <token>
    • Cookie: session_id=<token>
    • API-Key: <token>
  3. An API request returns the HTTP Status Code 401 Unauthorized. What does this indicate?

    • The requested resource URL does not exist on the server.
    • The request was successful and a new resource was created.
    • Authentication is missing, invalid, or expired.
    • The server encountered an internal unhandled exception.
  4. What is the default validity duration of an authentication token generated by the Cisco DNA Center /dna/system/api/v1/auth/token endpoint?

    • 15 minutes
    • 1 hour
    • 6 hours
    • 24 hours
  5. Which syntax formatting rule is strictly enforced in valid JSON data structures?

    • Single quotes (') must be used for string values.
    • Key names must be enclosed in double quotes (").
    • Comments are allowed using // or /* */.
    • Trailing commas are mandatory after the final item in an array.
  6. What HTTP status code returned by a REST API server indicates that a resource creation request submitted via POST was processed successfully?

    • 200 OK
    • 201 Created
    • 204 No Content
    • 400 Bad Request
  7. Which HTTP method is designed to perform an in-place partial update to a resource without replacing the entire existing object payload?

    • OPTIONS
    • POST
    • PUT
    • PATCH
  8. When authenticating to Cisco DNA Center REST APIs, what credentials must be sent to /dna/system/api/v1/auth/token to receive an X-Auth-Token?

    • An OAuth 2.0 Bearer token from an identity provider
    • HTTP Basic auth (Base64 of username:password)
    • A TLS client certificate presented during the handshake
    • An API key passed as a URL query string parameter
  9. Which statement accurately describes valid syntax formatting rules within a JSON document?

    • Keys must be wrapped in single quotes, and each key is separated from its value by an equals sign.
    • Keys must be double-quoted strings, and each key is separated from its value by a colon.
    • Nested objects must be indented with tab characters, and every line must end with a semicolon.
    • Comments may be added with a # symbol, as long as they appear on their own line above a key.
  10. What is a primary operational advantage of using Webhooks over periodic REST API Polling for event notification?

    • The device must expose privileged CLI access so the receiver can pull the event data directly.
    • Events are pushed to a callback URL as they happen, so the client no longer has to poll.
    • Webhooks skip TLS encryption, so each event payload is smaller than an equivalent REST response.
    • Webhooks run over serial console connections, so they keep working when the network is down.
  11. Which of the following examples represents valid JSON formatting syntax for key-value assignments?

    • { 'hostname': 'Core-Router', 'vlan': 10 }
    • { "hostname": "Core-Router", "vlan": 10 }
    • { hostname: "Core-Router"; vlan: 10 }
    • { "hostname": "Core-Router", "vlan": 10, }
  12. What HTTP status code is returned by Cisco Catalyst Center when an API request fails due to missing or invalid authentication token credentials in the request header?

    • 200 OK
    • 401 Unauthorized
    • 404 Not Found
    • 500 Internal Server Error
  13. In block-style YAML (the style used in Ansible playbooks), which formatting feature represents nested hierarchies and data scope?

    • Curly braces {} surrounding every nested block of keys
    • Space indentation (no tabs used for indenting)
    • A semicolon at the end of every line in a nested block
    • XML angle brackets <> around each parent element name