Cisco CCNA (200-301)Automation and ProgrammabilityMedium
A technician tests a REST API call using curl to retrieve device inventory from a controller. The response returns HTTP status code 401. What does this status code indicate?
- AThe requested resource was not found on the server
- BThe request succeeded and data was returned
- CThe server encountered an internal error
- DAuthentication credentials were missing or invalid
Show answer & explanationAnswer & explanation
Correct answer: D. Authentication credentials were missing or invalid
HTTP 401 Unauthorized means the request lacks valid authentication credentials, such as a missing or expired token. 404 indicates resource not found, 200 indicates success, and 500 indicates a server-side error.
Why the other options are wrong
- A. That description matches HTTP 404 Not Found, not 401.
- B. A successful response would return a 2xx code such as 200, not 401.
- C. That description matches HTTP 500 Internal Server Error, not 401.
HTTP Status Codes
HTTP status codes indicate the result of an API request: 2xx success, 4xx client error, 5xx server error.
- 200 OK = success
- 401 Unauthorized = authentication failure
- 404 Not Found = resource doesn't exist
- 500 Internal Server Error = server-side failure
Memory trick: 2xx good, 4xx your fault, 5xx server's fault.