Complete the code to specify the API version in the URL path.
GET /api/[1]/usersAPI versioning is often done by including the version number in the URL path, like /api/v1/.
Complete the code to add a new field in version 2 of the API without breaking version 1.
{
"name": "Alice",
"email": "alice@example.com",
"[1]": "123-456-7890"
}Adding a new field like phone in version 2 keeps version 1 unchanged, preventing breaking changes.
Fix the error in the versioning header to specify the API version correctly.
Accept: application/json; version=[1]The version in the Accept header is usually a simple number like 2 without extra letters.
Fill both blanks to create a new API version path and keep the old one working.
GET /api/[1]/products # old version GET /api/[2]/products # new version
Using v1 and v2 in the URL path allows both versions to work side by side.
Fill all three blanks to show how versioning prevents breaking changes by supporting multiple versions.
responses = {
"[1]": {"status": 200, "data": {...}},
"[2]": {"status": 200, "data": {..., "[3]": "new field"}}
}This shows version 1 response without the new field, and version 2 response with the added extra_info field, preventing breaking changes.