350-201 Question 261
Single answerWhile configuring an integration with a Cisco REST API, you receive a response code '401 Unauthorized' during your API call. What does this response code indicate, and how should you address it?
- A
The resource you are trying to access does not exist, and you should verify the endpoint URL.
- B
Your API request was missing authentication credentials or the provided credentials were invalid.
- C
The server is unable to process your request due to a malformed or invalid syntax in your API call.
- D
The request was successful, but the server is not returning any content in the response.
Show answer and explanation
Correct answer: B
Explanation
HTTP response code 401 Unauthorized is a common error encountered when working with REST APIs. It indicates that the client has not provided valid authentication credentials when attempting to access a protected resource. To resolve this, ensure that your API request includes the correct authentication headers, such as tokens or credentials, required by the API server.
- A. Incorrect.
This is incorrect. A response code of 404 indicates that the resource was not found, not an authentication issue.
- B. Correct.
This is correct. A response code of 401 Unauthorized means that the client must provide valid authentication credentials to access the resource.
- C. Incorrect.
This is incorrect. A response code of 400 (Bad Request) indicates an issue with the syntax or format of your API call, not an authentication issue.
- D. Incorrect.
This is incorrect. A response code of 204 indicates that the request was successful, but the server has no content to return, which is unrelated to authentication.