Apiary.io和/或API Blueprint是否支持api版本控制? [英] Does Apiary.io and/or API Blueprint support api versioning?

查看:72
本文介绍了Apiary.io和/或API Blueprint是否支持api版本控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

api蓝图或Apiary.io是否支持对API进行版本控制的概念?特别是,我通过URI这样对API进行版本控制:

Does api blueprint or Apiary.io support the notion of versioning your API? In particular, I'm versioning my API via the URI like this:

GET /api/v2/SomeResource/

在上面的示例中,这意味着我正在调用API的版本2("v2"). api蓝图支持吗?如何记录给定操作或整个API的多个版本?

In the example above, this means I'm calling version 2 ("v2") of the API. Does api blueprint support this? How can I document multiple versions of a given action or the entire API?

推荐答案

您可以使用HOST标头表示:

HOST: http://example.com/api/v2将为 all 资源加上/api/v2前缀.

在"API蓝图"中,如果您使用URL前缀,则认为这些API是不同的,因此应为它们使用不同的蓝图.

In the API Blueprint, if you use URL prefixing, the APIs are considered different and therefore you should use different blueprints for them.

如果您使用带有类型后缀的媒体类型来执行此操作,则只需在标头中指定正确的Content-Type即可,它们将被正确地用于模拟服务器中的内容协商.

If you use media types with version suffix to do that, you can just specify proper Content-Type in headers, and they'll be used properly for content negotiation in mock server.

这篇关于Apiary.io和/或API Blueprint是否支持api版本控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆