0
0
Rest APIprogramming~5 mins

Last-Modified and If-Modified-Since in Rest API - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the Last-Modified HTTP header?
The Last-Modified header tells the client the date and time when the requested resource was last changed. It helps the client know if the resource has been updated since the last time it was fetched.
Click to reveal answer
beginner
How does the If-Modified-Since header work in an HTTP request?
The client sends the If-Modified-Since header with a date to ask the server: "Send me the resource only if it has changed since this date." If the resource is unchanged, the server replies with a 304 Not Modified status, saving bandwidth.
Click to reveal answer
beginner
What HTTP status code does the server return if the resource has NOT been modified since the date in If-Modified-Since?
The server returns 304 Not Modified. This tells the client it can use its cached copy because the resource has not changed.
Click to reveal answer
intermediate
Why are Last-Modified and If-Modified-Since headers useful in REST APIs?
They reduce unnecessary data transfer by letting clients check if data changed before downloading it again. This improves performance and saves bandwidth.
Click to reveal answer
intermediate
Can If-Modified-Since be used with POST requests?
No, If-Modified-Since is typically used with GET requests to check resource freshness. POST requests usually change data and do not use this header.
Click to reveal answer
What does the server send if the resource has changed since the date in If-Modified-Since?
A200 OK with the updated resource
B500 Internal Server Error
C404 Not Found
D304 Not Modified
Which header does the server include to tell the client when the resource was last changed?
AIf-Modified-Since
BContent-Type
CLast-Modified
DCache-Control
What is the main benefit of using If-Modified-Since in client requests?
ATo reduce data transfer if resource is unchanged
BTo authenticate the client
CTo speed up server processing
DTo encrypt the data
If the client does NOT send If-Modified-Since, what will the server do?
AAlways return 304 Not Modified
BReturn the full resource with 200 OK
CReturn 403 Forbidden
DReturn 400 Bad Request
Which HTTP method is If-Modified-Since most commonly used with?
APUT
BPOST
CDELETE
DGET
Explain how Last-Modified and If-Modified-Since headers work together to optimize data transfer in REST APIs.
Think about how the client and server communicate about resource freshness.
You got /4 concepts.
    Describe a scenario where using If-Modified-Since would improve user experience in a web application.
    Imagine a news app or social media feed updating often.
    You got /4 concepts.