Bird
0
0

A REST API supports JSON and XML. The client sends:

hard📝 Application Q9 of 15
Rest API - Request and Response Format
A REST API supports JSON and XML. The client sends:
Accept: application/json;q=0.8, application/xml;q=0.8
Which format should the server choose and why?
Aapplication/xml because it is more verbose
BEither format, server's choice when q values tie
Capplication/json because it is listed first
DReturn 406 Not Acceptable due to tie
Step-by-Step Solution
Solution:
  1. Step 1: Analyze Accept header with equal quality factors

    Both JSON and XML have q=0.8, so equal priority.
  2. Step 2: Understand server choice on tie

    When q values tie, server can choose either supported format.
  3. Step 3: Eliminate incorrect options

    Order does not guarantee preference; 406 is not required for tie.
  4. Final Answer:

    Either format, server's choice when q values tie -> Option B
  5. Quick Check:

    Tie in q values = server chooses either format [OK]
Quick Trick: Equal q values let server pick any supported format [OK]
Common Mistakes:
  • Assuming first listed is always chosen
  • Thinking tie causes error 406
  • Choosing format based on verbosity

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes