php – 构建restful API的良好资源

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了php – 构建restful API的良好资源脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在寻找一个很好的资,它将向我展示构建一个安静的API的正确方法.
有趣的主题:特别是身份验证和一般安全性,性能,可伸缩性,最佳实践和其他有用的东西.

我将用PHP(Slim或Silex)构建它,在开始之前我想考虑整个设计,所以我可以从一开始就采用正确的方法.

网络上有很多信息和帖子,但他们都采用不同的做法和方法.

在宁静的世界里,有什么东西似乎是“标准”吗?

解决方法

不超出使用HTTP的级别.有许多用于API数据编码的媒体类型(参见下面的超媒体),许多不同的最佳实践和大量的Rfc,涵盖了使用HTTP的各个方面(例如使用OAuth2进行授权).

这是一本值得一读的资源汇编……我认为你将通过阅读一两本书来获得最大的收益.

认证资源

> Fieldings关于REST的原始论文:http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm

图书

> RESTful Web API:http://shop.oreilly.com/product/0636920028468.do
> RESTful Web Services CookBookhttp://shop.oreilly.com/product/9780596801694.do
>实践中的REST:http://shop.oreilly.com/product/9780596805838.do
> RESTful Web服务:http://amzn.com/0596529260
> Web API设计:https://pages.apigee.com/web-api-design-website-h-ebook-registration.html
> InfoQ子杂志关于REST:http://www.infoq.com/minibooks/emag-rest

认证

>基本考虑因素http://soabits.blogspot.dk/2014/02/api-authentication-considerations-and.html
> OAuth2规范:https://tools.ietf.org/html/rfc6749

错误处理

>最佳实践:http://soabits.blogspot.dk/2013/05/error-handling-considerations-and-best.html
>“vnd.error”错误详细信息的媒体类型https://github.com/blongden/vnd.error
> HTTP API的问题详细信息:https://tools.ietf.org/html/draft-ietf-appsawg-http-problem-00

超媒体

>菲尔丁的成名咆哮:http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
>销售超媒体的好处:http://soabits.blogspot.dk/2013/12/selling-benefits-of-hypermedia.html
> HAL媒体类型:HAL:http://stateless.co/hal_specification.html
> Sirene媒体类型:Sirene:https://github.com/kevinswiber/siren
>集合JSON:http://amundsen.com/media-types/collection/format/
> JSON API:http://jsonapi.org/
>九头蛇:http://www.markus-lanthaler.com/hydra/
> RFC 5988 Web链接http://tools.ietf.org/search/rfc5988

网址结构

>基本考虑因素:http://soabits.blogspot.dk/2013/10/url-structures-and-hyper-media-for-web.html

部分更新

>关于部分更新的注意事项http://soabits.blogspot.dk/2013/01/http-put-patch-or-post-partial-updates.html
> JSON-Patch:http://tools.ietf.org/html/rfc6902

脚本宝典总结

以上是脚本宝典为你收集整理的php – 构建restful API的良好资源全部内容,希望文章能够帮你解决php – 构建restful API的良好资源所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。