Bird
0
0

To efficiently reduce bandwidth in a REST API using If-None-Match, which client-server interaction sequence is most appropriate?

hard📝 Application Q8 of 15
Rest API - Caching Strategies
To efficiently reduce bandwidth in a REST API using If-None-Match, which client-server interaction sequence is most appropriate?
AClient sends <code>If-None-Match</code> with last ETag; server returns 304 if unchanged, else 200 with new data and ETag
BClient sends no headers; server always returns full data with ETag
CClient sends <code>If-None-Match</code> with random value; server ignores and returns 200
DServer sends 304 responses unconditionally to reduce bandwidth
Step-by-Step Solution
Solution:
  1. Step 1: Understand client role

    The client includes the last known ETag in the If-None-Match header.
  2. Step 2: Server compares ETags

    If the ETag matches the current resource, server returns 304 Not Modified without body.
  3. Step 3: Server sends updated data if changed

    If ETags differ, server returns 200 OK with new data and updated ETag.
  4. Final Answer:

    Client sends If-None-Match with last ETag; server returns 304 if unchanged, else 200 with new data and ETag -> Option A
  5. Quick Check:

    Conditional requests save bandwidth [OK]
Quick Trick: Send last ETag; get 304 if unchanged, else new data [OK]
Common Mistakes:
MISTAKES
  • Not sending If-None-Match header at all
  • Server ignoring ETag and always sending full data
  • Server sending 304 responses regardless of resource state

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes