Bird
0
0

An integration test fails because the API returns status code 401 Unauthorized.

medium📝 Debug Q7 of 15
Rest API - API Testing and Monitoring
An integration test fails because the API returns status code 401 Unauthorized.
Which fix is most appropriate?
AAdd authentication headers or tokens to the request
BChange the request method to GET
CIncrease the timeout value
DUse a different API endpoint
Step-by-Step Solution
Solution:
  1. Step 1: Understand 401 status meaning

    401 means unauthorized access, usually missing or invalid authentication.
  2. Step 2: Identify correct fix

    Adding authentication headers or tokens solves unauthorized errors.
  3. Final Answer:

    Add authentication headers or tokens to the request -> Option A
  4. Quick Check:

    401 Unauthorized = add authentication [OK]
Quick Trick: 401 means add auth headers or tokens [OK]
Common Mistakes:
MISTAKES
  • Changing HTTP method without fixing auth
  • Assuming timeout causes 401
  • Switching endpoints without auth

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes