New to writing REST APIs. Had a question about versioning.
Let's say that we have a service with the following methods:
- Search <- Given some data, it will perform a search
- Billing <- Given a time-range, it will provide usage information on the Search API.
- EnhanceIndex <- Client can send data to increase the search index.
Let's say that I now decide to only update the "Search" API. What REST versioning format would make sense?
Should I do
- example.com/search/v2/...
- example.com/billing/v1/... <- Still provides data from the v2 api
- example.com/enhance_index/v1/... <- Still influences searches in v2 api
or
- example.com/v2/search/...
- example.com/v1/billing/... <- Still provides data from the v2 api
- example.com/v1/enhance_index/... <- Still influences searches in v2 api
or
- example.com/v2/search/...
- example.com/v2/billing/... <- Same API as V1.
- example.com/v2/enhance_index/... <- Same API as V1
Or something else? Also, is it a bad practice if I don't update all the endpoints in one-go (even if there is no diff), and have some V1 endpoints around that are affected by V2 usages (and vice-versa)?
I've also read a bit about putting the versioning in the mime type, however I don't think that really addresses the question above, it just seems like a non-URI version of the same thing (but correct me if I'm wrong). In general, should I still consider Header-based versioning anyway? (I noticed that a lot of public APIs still put it in the URI)
Thanks!