1 Why we need API design and documentation

2018-02-24 16:10 更新

来源: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,以便对双方进行一定的约束,从而形成一种双方都可以遵守的契约式的协议, 在某些层面增加少许工作量的同时,为双方提供便利和参考。

以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号