3 ms·
Why is it considered best practice to use the content type header for API versioning? It always seemed like a hack to me. Url versioning makes much more sense i
by Cakez0r 11y ago
Why is it considered best practice to use the content type header for API versioning? It always seemed like a hack to me. Url versioning makes much more sense if you consider that your API is a resource and the content of your API is a subresource. E.G. GET /v1/post/1/comment/456 would be semantically equivalent to "give me comment with id 456, which belongs to post with id 1, which belongs to api of version 1".
- subliminalbrad 11y agoThe URL is meant to represent a specific resource. You're requesting a comment resource, not a version of a comment resource. It's semantically inappropriate and may lead to unnecessary complexity. There is an HTTP concept created specifically for this idea. Why not use it?