PHPMaster.com has posted the second part of their best practices in REST APIs series with this new post focusing more on the implementation part of things.
We ended the first part of this tutorial with all the basic layers of our API in place. We have our server setup, authentication system, JSON input/output, error management and a couple of dummy routes. But, most importantly, we wrote the README file that defines resources and actions. Now it's time to deal with these resources.
They move on and add more functionality for creating (POST) and updating (PUT/PATCH) contacts in the system. They also show how to list contacts and add in some search handling allowing for sorting and returning only certain data. There's also some code for pagination handling, locating a single contact record, basic caching and simple rate limiting.
Link: http://www.sitepoint.com/best-practices-rest-api-scratch-implementation/
没有评论:
发表评论