0
0
Rest APIprogramming~10 mins

Why versioning prevents breaking changes in Rest API - Test Your Understanding

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

Complete the code to specify the API version in the URL path.

Rest API
GET /api/[1]/users
Drag options to blanks, or click blank then click option'
Av1
Bversion
Capi
Dusers
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'version' or 'api' instead of the version number.
2fill in blank
medium

Complete the code to add a new field in version 2 of the API without breaking version 1.

Rest API
{
  "name": "Alice",
  "email": "alice@example.com",
  "[1]": "123-456-7890"
}
Drag options to blanks, or click blank then click option'
Aphone
Bversion
Cage
Daddress
Attempts:
3 left
💡 Hint
Common Mistakes
Changing existing fields or removing fields in version 1.
3fill in blank
hard

Fix the error in the versioning header to specify the API version correctly.

Rest API
Accept: application/json; version=[1]
Drag options to blanks, or click blank then click option'
Aversion2
Bv2
C1.0
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'v2' or 'version2' which may not be recognized.
4fill in blank
hard

Fill both blanks to create a new API version path and keep the old one working.

Rest API
GET /api/[1]/products  # old version
GET /api/[2]/products  # new version
Drag options to blanks, or click blank then click option'
Av1
Bv2
Cversion1
Dversion2
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'version1' or 'version2' which is less common.
5fill in blank
hard

Fill all three blanks to show how versioning prevents breaking changes by supporting multiple versions.

Rest API
responses = {
  "[1]": {"status": 200, "data": {...}},
  "[2]": {"status": 200, "data": {..., "[3]": "new field"}}
}
Drag options to blanks, or click blank then click option'
Av1
Bv2
Cextra_info
Ddeprecated
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'deprecated' as a field name or mixing version keys.