When you are developing Web Service for CRUD (Create, Read, Update, Delete) operations you may find it is easy to implement it as RESTful service. In this Demo on RESTful CRUD Service You can have an idea how you develop such a service with WSO2 WSF/PHP.
Here we take a scenario of submitting applications (say for a school).
In RESTful world we map a resource to a unique URL. In this demo, application is a resource. We use the URL “application/{id}” to represent a particular application with the id {id}.
You can use HTTP verb + Resource URL touples to manipulate the resource with CRUD operations. Here is how it is done in this particular demonstration.
Request format (HTTP Verb + URL) | Operation Semantic |
POST applications/{id} | Create an application |
GET applications/{id} | Get an application |
PUT applications/{id} | Change an application |
DELETE applications/{id} | Delete an application |
Go for the wsf/php demo sitefor the live demo of this service. Visit the demo service source code to see how easy to implement it with WSF/PHP Data Services library.
I wrote a similar blog on Data Services last week to demonstrate how you design the mapping of url to different resources in a RESTful Service.
Pingback: The Design of the Twitter REST API | Dimuthu's Blog