0
0
Rest APIprogramming~10 mins

Versioning best practices 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 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
Bversion1
Capi1
Dusers
Attempts:
3 left
💡 Hint
Common Mistakes
Using descriptive words like 'version1' instead of 'v1'.
Putting 'users' as the version segment.
2fill in blank
medium

Complete the header to specify the API version using a custom header.

Rest API
X-API-[1]: 1
Drag options to blanks, or click blank then click option'
Av
Bver
Capi
Dversion
Attempts:
3 left
💡 Hint
Common Mistakes
Using too short or unclear header names like 'ver' or 'v'.
Using 'api' which is too generic.
3fill in blank
hard

Fix the error in the versioning strategy by choosing the correct versioning method.

Rest API
Accept: application/json; version=[1]
Drag options to blanks, or click blank then click option'
Aversion1
Bv1
C1.0
Dapi1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'v1' or 'version1' which are not standard in Accept header.
Using 'api1' which is unclear.
4fill in blank
hard

Fill both blanks to create a versioned API endpoint with query parameter versioning.

Rest API
GET /api/users?[1]=[2]
Drag options to blanks, or click blank then click option'
Aversion
Bv
C1
Dv1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'v' as parameter name which is less clear.
Using 'v1' as version value which mixes prefix and number.
5fill in blank
hard

Fill all three blanks to define a versioned API using media type versioning in the Accept header.

Rest API
Accept: application/vnd.myapp.[1]+json; version=[2]; q=[3]
Drag options to blanks, or click blank then click option'
Avnd
B1
C0.9
Dv1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'vnd' as version in media type which is part of the type prefix.
Using 'v1' as quality factor which should be a decimal.