0
0
Rest APIprogramming~20 mins

Deprecation communication in Rest API - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Deprecation Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the HTTP status code returned for a deprecated API endpoint?
Consider a REST API that marks an endpoint as deprecated but still functional. What HTTP status code should the server ideally return to inform clients about deprecation without breaking functionality?
A200 OK with a custom warning header indicating deprecation
B404 Not Found because the endpoint is deprecated
C410 Gone to indicate the endpoint is permanently removed
D500 Internal Server Error due to deprecated code
Attempts:
2 left
💡 Hint
Think about how to keep the endpoint working but still warn clients.
🧠 Conceptual
intermediate
1:30remaining
Why use a 'Deprecation' header in REST APIs?
What is the main purpose of including a 'Deprecation' HTTP header in REST API responses?
ATo block clients from accessing the deprecated endpoint
BTo inform clients that the API endpoint will be removed in the future
CTo provide authentication credentials
DTo indicate the API response format
Attempts:
2 left
💡 Hint
Think about communication with clients regarding future changes.
🔧 Debug
advanced
2:30remaining
Identify the issue in this deprecation warning implementation
This API code snippet tries to add a deprecation warning header but clients do not see it. What is the problem?
Rest API
def get_user(request):
    response = get_user_data()
    response.headers['Deprecation'] = 'true'
    return response
AThe response object does not support headers
BHeaders must be added before the response object is created
CThe header name should be lowercase 'deprecation'
DThe 'Deprecation' header value should be a date or URL, not 'true'
Attempts:
2 left
💡 Hint
Check the expected format of the 'Deprecation' header value.
📝 Syntax
advanced
2:00remaining
Which code snippet correctly adds a deprecation warning header in Express.js?
You want to add a 'Warning' header to indicate API deprecation in an Express.js route. Which snippet is correct?
Ares.addHeader('Warning', '299 - Deprecated API'); res.send(data);
Bres.set('Warning', 299 - 'Deprecated API'); res.send(data);
Cres.setHeader('Warning', '299 - "Deprecated API"'); res.send(data);
Dres.header('Warning', 299 - 'Deprecated API'); res.send(data);
Attempts:
2 left
💡 Hint
Check the correct method name and header value format.
🚀 Application
expert
3:00remaining
How to communicate API version deprecation effectively?
You maintain a REST API with version v1 and v2. You want to deprecate v1 but keep it working for 6 months. Which approach best communicates this to clients?
AReturn 200 OK with 'Deprecation' and 'Sunset' headers indicating removal date, and document in API docs
BReturn 404 Not Found for all v1 requests immediately
CReturn 500 Internal Server Error with a message about deprecation
DRemove v1 endpoints without notice and update docs silently
Attempts:
2 left
💡 Hint
Think about gradual migration and clear communication.