0
0
Rest APIprogramming~10 mins

Deprecation communication in Rest API - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add a deprecation warning header in the API response.

Rest API
response.headers['[1]'] = 'This API endpoint is deprecated and will be removed soon.'
Drag options to blanks, or click blank then click option'
AAuthorization
BContent-Type
CX-Deprecation-Warning
DAccept
Attempts:
3 left
💡 Hint
Common Mistakes
Using standard headers like 'Content-Type' or 'Authorization' for deprecation messages.
2fill in blank
medium

Complete the code to set the deprecation date in the response header.

Rest API
response.headers['Deprecation-Date'] = '[1]'
Drag options to blanks, or click blank then click option'
A2023-01-01
B01/01/2023
CJanuary 1, 2023
D2023.01.01
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-standard date formats that can confuse clients.
3fill in blank
hard

Fix the error in the code to correctly add a deprecation notice in JSON response.

Rest API
return [1](jsonify({'message': 'Deprecated endpoint'}), 299)
Drag options to blanks, or click blank then click option'
Ajsonify
Bmake_response
CResponse
Dsend_response
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'jsonify' alone with a status code, which causes errors.
4fill in blank
hard

Fill both blanks to add a deprecation warning and set the warning header in the response.

Rest API
response = [1](jsonify({'warning': 'Deprecated API'}))
response.headers['[2]'] = 'Use new API version'
Drag options to blanks, or click blank then click option'
Amake_response
Bjsonify
CX-Deprecation-Warning
DContent-Type
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'jsonify' directly without wrapping in 'make_response'.
Setting standard headers instead of the deprecation warning header.
5fill in blank
hard

Fill all three blanks to create a JSON response with a deprecation message, set status code 299, and add a deprecation header.

Rest API
resp = [1](jsonify({'message': [2]), [3])
resp.headers['X-Deprecation-Warning'] = 'Deprecated endpoint'
Drag options to blanks, or click blank then click option'
Amake_response
B'This endpoint is deprecated'
C299
Djsonify
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'jsonify' instead of 'make_response' to set status code.
Not quoting the message string.
Using wrong status code.