两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 |
public:it:restful [2016/11/26 15:13] – [Tools] oakfire | public:it:restful [2018/02/28 13:48] (当前版本) – 外部编辑 127.0.0.1 |
---|
===== Tools ===== | ===== Tools ===== |
* API 接口设计工具: [[http://swagger.io/|swagger]], 支持 json/[[.:yaml|yaml]] 描述, 工具链最齐全。 | * API 接口设计工具: [[http://swagger.io/|swagger]], 支持 json/[[.:yaml|yaml]] 描述, 工具链最齐全。 |
| * :!: swagger editor 工具, 如果 ''$ref'' 的值的格式错误,会出现不能定位到行的 error, 这时候只好一个个检查所有 $ref 的格式来甄别; |
| * :!: 还是 swagger editor 工具, mac chrome 下输入汉字会出现字母与汉字齐飞,还未解决。 |
* API 接口设计工具: [[http://raml.org/|raml]], [[.:yaml|yaml]] 描述, 比较精简干练,但工具还不成熟。 | * API 接口设计工具: [[http://raml.org/|raml]], [[.:yaml|yaml]] 描述, 比较精简干练,但工具还不成熟。 |
* API 框架: [[http://restify.com/|restify]], 效率上与express差不多, 但配套(throttling,监控)等比较方便。 | * API 框架: [[http://restify.com/|restify]], 效率上与express差不多, 但配套(throttling,监控)等比较方便。 |
* 数据校验(validation): [[https://www.npmjs.com/package/joi|joi]] | * API 检测工具:[[https://www.getpostman.com/|Postman]] |
| * 数据校验(validation): [[https://www.npmjs.com/package/joi|joi]], [[https://github.com/tlivings/enjoi|json-schema to joi]] |
| * ACL 权限控制参考参考 [[https://www.npmjs.com/package/express-acl|express-acl]] |
| * 认证 auth: HMAC Auth: [[http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html|amazon s3 REST auth]], 好像使用[[https://github.com/joyent/node-http-signature/blob/master/http_signing.md|http signing]] 比较好。 然后 restify 的自带插件有判断请求时间 |
===== Articles ===== | ===== Articles ===== |
| * [[http://www.infoq.com/cn/articles/understanding-restful-style|理解本真的REST架构风格]] |
* [[http://www.infoq.com/cn/articles/designing-restful-http-apps-roth|RESTful HTTP的实践]] | * [[http://www.infoq.com/cn/articles/designing-restful-http-apps-roth|RESTful HTTP的实践]] |
* [[http://www.ruanyifeng.com/blog/2014/05/restful_api.html|阮一峰:RESTful API 设计指南]] | * [[http://www.ruanyifeng.com/blog/2014/05/restful_api.html|阮一峰:RESTful API 设计指南]] |
| |
===== Notes ===== | ===== Notes ===== |
* 在RESTful架构中,每个网址代表一种资源(resource),所以网址中不能有动词,只能有名词; 资源的 collection 用英文名词复数表示 | * 在RESTful架构中,每个网址代表一种资源(resource),所以网址中不能有动词,只能有名词; 资源的 collection 用英文名词复数表示 |
|:::|:::|:::|:::| 400 | INVALID REQUEST | 用户发出的请求有错误,服务器没有进行操作 | | |:::|:::|:::|:::| 400 | INVALID REQUEST | 用户发出的请求有错误,服务器没有进行操作 | |
| |
更多参考 [[https://tools.ietf.org/html/rfc7231#section-6|rfc7231]] | 更多参考 [[https://tools.ietf.org/html/rfc7231#section-6|rfc7231]] 以及 [[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes|List of HTTP status codes]] |
| |
| |