Google Professional Cloud Developer Question 321
Single answerGoogle Cloud PlatformYou are developing a new version of a REST API for a microservices-based application deployed on Google Kubernetes Engine (GKE). A client application depends on the current API version. To preserve backward compatibility, which approach should you take while introducing the changes?
- A
Add new endpoints for the updated functionality and keep the existing endpoints unchanged.
- B
Rename the existing endpoints to match the updated version and remove the old ones.
- C
Modify the request and response structure of existing endpoints to accommodate the new functionality.
- D
Deprecate the current API version immediately and force the client to switch to the new version.
Show answer and explanation
Correct answer: A
Explanation
Backward compatibility ensures that existing clients continue to function without changes when new API versions or features are introduced. The best approach is to add new endpoints for updated functionality while keeping existing ones intact, allowing the clients to migrate at their own pace.
- A. Correct.
This is the correct approach, as adding new endpoints for updated functionality allows existing clients to continue using the current API without any disruption, thus preserving backward compatibility.
- B. Incorrect.
Renaming existing endpoints and removing old ones will break backward compatibility as the client application relying on the current API will fail.
- C. Incorrect.
Modifying the request and response structure of existing endpoints will break the functionality for the client application that depends on the current version of the API.
- D. Incorrect.
Deprecating the current API version immediately and forcing the client to switch to the new version does not preserve backward compatibility and can lead to disruptions for the client.