Answer the question
In order to leave comments, you need to log in
Versioning in REST API?
There is an implementation of some rest api.
The oldest version, v1, has the path site/api by default. The newer one has site/v2/api.
Now in v2 we need to make incompatible changes to one method. It is not reasonable to change to v3 because of this, since 99% of the functionality remains the same.
It was decided to introduce semantic versioning according to the semver.org specification for the second implementation of the REST API. Those. api v2 will have its own versioning.
For accounting, I consider the library https://github.com/nikolaposa/version
The
question arose, how best to take into account the version in the code?
Those. it's stupid to write a condition in the code, if the major version of the requested API is less than 2, then I execute such code, otherwise another one?
Are there any good practices?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question