Restful API Study Notes
Basic
Q: What does REST mean?
A: REpresentational State Transfer. In REST Architecture everything is a resource.
Q: What is RESTful Web Services?
A: RESTful Web Services are basically REST Architecture based Web Services, it uses HTTP Protocol. A resource is accessed by a common interface using HTTP standard methods(GET, POST, DELETE, PUT). Each resource is identified by URIs/ global IDs. A RESTful web service usually defines a URI, provides resource representation such as JSON and set of HTTP Methods.
Q: Benefits?
A: RESTful web services are light weight, highly scalable and maintainable and are very commonly used to create APIs for web-based applications.
In conclusion, RESTful web services make use of HTTP protcols as a medium of communication between cilent and server.
How to Design
A URI looks like:<protocol>://<service-name>/<ResourceType>/<ResourceID>
Points should be considered:
- Use Plural Noun - Define Resouces
- Avoid using spaces - Use ‘_’ or ‘-‘ if the needed
- Lowercase letters only
- Maintain backward compaibility
- HTTP verb - use HTTP Verb like GET, PUT and DELETE to do the operations on the resource. But not to use operations name in the URI. (CRUD - create read update delete)
Tools needed
Chrome REST APL testing: Restlet Client - REST API Testing
Local Web development solution: MAMP