How to factor in API versioning at the design stage
There are some standard ways of applying versioning to REST APIs. Usually, you will have some subpath in your URL that contains the version number. This way, you can host several different versions of the API simultaneously. And your clients will never communicate with the wrong version, as the version number will be written into the address that they submit requests to.
For example, you may have a URL like this:
https://example.com/status/v1
In this example, v1
would represent the API version number. Then, if you need to update your API, you will not modify the original endpoints. Instead, you will host another version of it at the address that ends with v2
. This way, the functionality of the existing clients will not change at all, as nothing in the backend that they are talking to would have changed. And this is why you don't have to worry about your new API being compatible with the old clients.
The same principles...