Bird
0
0

You want to create a new user resource with a POST request but also want the server to return the full created user data in the response. Which HTTP header should you include to request this behavior?

hard📝 Application Q8 of 15
Rest API - HTTP Methods
You want to create a new user resource with a POST request but also want the server to return the full created user data in the response. Which HTTP header should you include to request this behavior?
ACache-Control: no-store
BAccept: application/xml
CAuthorization: Bearer token
DPrefer: return=representation
Step-by-Step Solution
Solution:
  1. Step 1: Understand how to request full resource in response

    The Prefer header with return=representation asks server to return created resource.
  2. Step 2: Match header with desired behavior

    Prefer: return=representation correctly uses Prefer: return=representation for this purpose.
  3. Final Answer:

    Prefer: return=representation -> Option D
  4. Quick Check:

    Use Prefer header to get full resource back [OK]
Quick Trick: Use Prefer: return=representation to get created resource back [OK]
Common Mistakes:
  • Using Accept header which controls response format, not content
  • Ignoring Prefer header for controlling server response
  • Confusing Authorization with response control

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes