REST APIs: practice questions

REST-based APIs: CRUD operations and HTTP methods, the request and response model, authentication and data encoding.

CCNA 200-301 v1.1, exam topic 6.5 · part of 6. Automation and Programmability, 10% of the exam

What this topic covers

Programmatic interfaces
Managing devices through APIs instead of the CLI.
REST
Each service is a web resource named by a URI and used through standard HTTP methods.
HTTP methods
GET retrieves a resource, POST sends information to the server, PUT stores a resource at a URL and DELETE removes it.
Request/response model
Clients send methods such as GET; servers return status codes.
HTTPS
HTTP carried over TLS for confidentiality and authentication.

Sample question

Try it, then open the answer. Our questions are written by AI and checked independently before they are published.

Medium Single choice

Refer to the exhibit. Which operation does this HTTP request perform on the interface resource?

Client HTTP request
PUT /api/v1/devices/R1/interfaces/Vlan10 HTTP/1.1
Content-Type: application/json

{"description": "Uplink to SW1", "enabled": true}
  1. A. Returns the current interface resource at this URI.
  2. B. Deletes the interface resource identified by this URI.
  3. C. Creates a new interface resource in the interfaces collection.
  4. D. Replaces the interface resource at this URI with the request body.
Show the answer

Answer: D. Replaces the interface resource at this URI with the request body.

The request line uses PUT, which stores a resource at a fully specified URI. The URI /api/v1/devices/R1/interfaces/Vlan10 names one interface resource, and the JSON body is the representation that replaces it. The method, not the URI alone, sets the action: the same URI with GET would retrieve the resource and with DELETE would remove it.

Further reading