我看不到对我的网站进行版本控制的好处 api?

I can't see the benefits of versioning my web api?

为什么我应该对我的网站进行版本控制 api?我真的不明白我为什么要这样做。

我已阅读这篇文章:https://vladsukhachev.wordpress.com/2016/12/12/web-api-versioning-in-real-world-applications/

在文章中,作者为版本 1 创建了一个名为 GetV1_0 的方法。然后他基本上再次创建了相同的方法,但将方法重命名为版本 1.1 的 GetV1_1。为什么?我为什么要这样做?为什么不只更改第一个而不进行任何版本控制?

谁能给我带来一些好处,为什么我应该这样做,而不是在应该添加任何新内容时只更新方法?

在您链接到的 article 的第一段中有解释:

Customers who use your API expect it to not change. Otherwise their code may fail due to changed contract or behavior. But requirements will change and we need to figure out a way to evolve API without breaking existing clients. So every time when a breaking API change occurs you need to release a new version of API. That does not mean you need to support all versions forever. But you need to get rid of old versions of API with some care so customers have an idea how to move to a newer version of API.

想象一个场景,您编写了一个 API 供其他人编写的软件使用。他们只能在您的 API 的新版本发布后才能开始开发新版本的软件。但是他们不希望他们现有的应用程序在适应您的新应用程序时中断 API.

我想你可以发布一个其他人可以测试的测试版本,然后只在每个人都迁移后才发布,但这种策略不适用于许多用户。

通过对您的 API 调用进行版本控制,这些其他人的现有应用程序可以继续 运行,同时他们开发适用于您的 API 新版本的新版本。