ThinkSSL🔒 一键申购 5分钟快速签发 30天无理由退款 购买更放心 广告
> 来源:[http://afoo.me/posts/2015-03-17-api-design-and-documentation.html](http://afoo.me/posts/2015-03-17-api-design-and-documentation.html) > 作者:陨石 - yunshi@wacai.com HTTP API (现在很多地方都使用REST API这个术语, 不过注意这里使用的是HTTP API,至于为什么, 嘿嘿,自己意会吧 ;-)↩) can't be typesafe as per the http protocol's essential, so we need to find a way so that the api providers and consumers can come to the same rendzvous point with proper constraits and clarity. HTTP协议的特性决定了基于HTTP的API属于松散类型(与强类型或者说类型安全的API相对应), 为了能够让API的提供者和消费者可以一种双方都可以明晰且明确的方式达成共识, 我们需要找到一种方式来描述API,以便对双方进行一定的约束,从而形成一种双方都可以遵守的契约式的协议, 在某些层面增加少许工作量的同时,为双方提供便利和参考。 ![](https://box.kancloud.cn/2015-07-14_55a4e26a00d6d.png)