Which approach correctly handles this in a single endpoint?
hard🚀 Application Q15 of Q15
Rest API - Versioning Strategies
You want to support versions 1 and 2 of your API using query parameter versioning. Version 1 returns a list of users as strings, and version 2 returns a list of user objects with 'name' and 'id'. Which approach correctly handles this in a single endpoint?
AReturn an error if version parameter is missing or unknown
BChange the URL path to /v1/users and /v2/users instead of query parameters
CIgnore the version parameter and always return the latest format
DUse <code>?version=1</code> to return ['Alice', 'Bob'], and <code>?version=2</code> to return [{'name':'Alice','id':1},{'name':'Bob','id':2}]