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

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.
主站蜘蛛池模板: 灵石县| 刚察县| 新丰县| 永川市| 惠安县| 兰州市| 清流县| 靖边县| 瓦房店市| 行唐县| 定南县| 咸阳市| 呼伦贝尔市| 德钦县| 鄂托克旗| 民丰县| 桂平市| 于田县| 鄯善县| 通海县| 红桥区| 建昌县| 尼勒克县| 类乌齐县| 韩城市| 兴安县| 深圳市| 郑州市| 嘉兴市| 双城市| 延庆县| 陕西省| 宜城市| 安图县| 咸阳市| 吉水县| 广平县| 邓州市| 栾城县| 冷水江市| 明光市|