| Making the version optional is a bad idea, IMO. It lets consumers use your API without versioning, which is like telling them, “here, create a time bomb that may or may not explode when the next breaking api change is released.” There’s zero practical user benefit to NOT specifying the version, so why not enforce it? You’re creating a footgun otherwise. Furthermore as others have pointed out, this is a purely cosmetic change. Using /api/$UNIQUE_STR in the URL vs. X-GitHub-Version: $UNIQUE_STR in the header are functionally equivalent, so… Why bother making this change then? What was suboptimal about the previous way? What benefit does this bring? EDIT:
Serves me right for not reading the docs more carefully. From the docs [1]: Requests without the X-GitHub-Api-Version header will default to use the 2022-11-28 version. See phphphphp’s reply below for context. [1] https://docs.github.com/en/rest/overview/api-versions?apiVer... |
The benefit of this new versioning approach is that they can maintain backwards compatibility for existing implementations while introducing breaking changes for new implementations to benefit from.
In an ideal world, sure, they should have implemented this from the start, but they didn’t, so going forward they have to accommodate both existing implementations (by not breaking anything) and new implementations (by providing features that would break existing implementations).
They’re basically just implementing stripe’s well-understood and battle tested approach for versioning, while maintaining backwards compatibility. I am struggling to see any problems with the approach, in fact, it seems like the only right approach (?)