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

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.
主站蜘蛛池模板: 古田县| 东莞市| 定远县| 永安市| 苍溪县| 磐石市| 百色市| 奇台县| 万年县| 连州市| 册亨县| 邢台市| 淄博市| 西平县| 南澳县| 中牟县| 新巴尔虎右旗| 赫章县| 甘谷县| 东乌珠穆沁旗| 蒙城县| 阿拉善左旗| 东港市| 泾阳县| 青海省| 黄平县| 郁南县| 神农架林区| 洞口县| 怀仁县| 革吉县| 伊吾县| 博白县| 浦东新区| 潞城市| 普宁市| 宁城县| 临湘市| 隆尧县| 华安县| 嘉义县|