Recall & Review
beginner
What is an ETag in the context of REST APIs?
An ETag (Entity Tag) is a unique identifier assigned by a server to a specific version of a resource. It helps clients know if the resource has changed since the last time they accessed it.
Click to reveal answer
beginner
How does a client use an ETag for conditional requests?
The client sends the ETag value in the 'If-None-Match' header when requesting a resource. The server compares it with the current ETag and returns the resource only if it has changed; otherwise, it returns a 304 Not Modified status.
Click to reveal answer
beginner
What HTTP status code indicates that the resource has not changed when using ETag?
The server returns HTTP status code 304 Not Modified to tell the client that the resource has not changed and the cached version can be used.
Click to reveal answer
intermediate
Why are ETags useful for web performance?
ETags reduce bandwidth and improve performance by allowing clients to avoid downloading unchanged resources. This saves time and network data by using cached versions when possible.
Click to reveal answer
intermediate
What is the difference between a strong and a weak ETag?
A strong ETag changes whenever the resource changes in any way. A weak ETag may not change for minor differences and is prefixed with 'W/'. Weak ETags allow some flexibility in caching but may not detect all changes.
Click to reveal answer
What header does a client send to use an ETag for conditional GET requests?
✗ Incorrect
The client sends the ETag value in the 'If-None-Match' header to ask the server if the resource has changed.
What does the server return if the resource has not changed when using ETag?
✗ Incorrect
The server returns 304 Not Modified to indicate the cached resource is still valid.
Which of the following best describes a weak ETag?
✗ Incorrect
Weak ETags are prefixed with 'W/' and allow some flexibility by not changing for minor differences.
Why are ETags important for caching?
✗ Incorrect
ETags help clients check if their cached copy is still valid, avoiding unnecessary downloads.
Which HTTP method commonly uses ETags for conditional requests?
✗ Incorrect
ETags are most commonly used with GET requests to check if the resource has changed.
Explain how ETags help improve web application performance.
Think about how caching works with version checks.
You got /5 concepts.
Describe the difference between strong and weak ETags and when you might use each.
Consider strictness of change detection.
You got /5 concepts.