官术网_书友最值得收藏!

Recommendation

When using a RESTful service, it is highly recommended that you use header-based versioning. However, the recommendation is to keep the version in the URL. This strategy allows the consumers to open the API in a browser, send it in an email, bookmark it, share it more easily, and so on. This format also enables human log readability.

There are also a few more recommendations regarding API versioning:

  • Use only the major version: API consumers should only care about breaking changes.
  • Use a version number: Keep things clear; numbering the API incrementally allows the consumer to track evolvability. Versioning APIs using timestamps or any other format only creates confusion in the consumer's mind. This also exposes more information about versioning than is necessary.
  • Require that the version has to be passed: Even though this is more convenient from the API producer's perspective, starting with a version is a good strategy because the consumers will know that the API version might change and they will be prepared for that.
  • Document your API time-to-live policy: Good documentation is a good path to follow. Keeping everything well-described will mean that consumers avoid finding out that there is no Version 1 available anymore because it has been deprecated. Policies allow consumers to be prepared for issues such as depreciation.
主站蜘蛛池模板: 湟源县| 班戈县| 遵化市| 四会市| 楚雄市| 神木县| 温泉县| 曲松县| 类乌齐县| 茂名市| 仙居县| 和龙市| 曲沃县| 通江县| 商河县| 图木舒克市| 宜都市| 忻州市| 毕节市| 葫芦岛市| 万荣县| 武平县| 子长县| 武川县| 上虞市| 汨罗市| 泽州县| 怀集县| 长沙县| 隆子县| 子洲县| 乳山市| 青河县| 阿拉善右旗| 绵竹市| 灵台县| 高淳县| 信阳市| 怀化市| 沅陵县| 梁河县|