Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to specify the version in the URL path.
HLD
GET /api/[1]/users Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using descriptive words instead of short version tags.
✗ Incorrect
The common practice is to include the version as 'v1' in the URL path.
2fill in blank
mediumComplete the code to specify the version using a custom header.
HLD
GET /users
Headers: Accept: application/json; [1]=v2 Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing 'Content-Type' or 'Accept' headers with versioning.
✗ Incorrect
The 'api-version' header is commonly used to specify API version in headers.
3fill in blank
hardFix the error in the versioning query parameter.
HLD
GET /users?[1]=1
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using unclear or abbreviated query parameter names.
✗ Incorrect
The query parameter 'version' is the most clear and widely used for versioning.
4fill in blank
hardFill both blanks to complete the header-based versioning example.
HLD
GET /users Headers: [1]: application/json Headers: [2]: v3
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing 'Content-Type' with 'Accept' or using wrong version header names.
✗ Incorrect
The 'Accept' header specifies the media type, and 'api-version' specifies the API version.
5fill in blank
hardFill all three blanks to complete the versioning strategy using media type versioning.
HLD
GET /users Headers: Accept: application/vnd.myapp.[1]+json Response Content-Type: application/vnd.myapp.[2]+json API version used: [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different versions in Accept and Content-Type headers.
✗ Incorrect
Media type versioning uses the version in the Accept header and Content-Type. Both should match the version used.