Read this for basic training ... I'm stuck in What is REST ... !!!
A content management system may contain a set of articles. Two sources are implied here. Firstly, there are separate articles. Each source of resources. Theres also a second resource: a collection of articles.
To get a list of all the articles, we can send an HTTP GET request to this collection, say, along the path / articles. To get the contents of a single resource, we need to identify it. The Rails path would have to give its primary key value (i.e. its identifier). Again wed issued a GET request, this time against URL / articles / 1. So far, it all looks pretty familiar. But what happens when we want to add an article to our collection?
In non-RESTful applications, perhaps come up with some kind of action with a verb phrase as the name: articles / add_article / 1. In the REST world, it was not proposed to do this: it was supposed to tell resources what to do using a standard set of verbs. To create a new article in our collection using REST, use the HTTP POST request directed to the / articles path with the message data containing the added article. Yes, the same path we used to get the list of articles: if you issue a GET, it responds with a list, and if you do a POST, it adds a new article to the collection.
Take one more step. We have already seen that you can retrieve the contents of an article, issue a GET request to the path / articles / 1. To update this article, you invoke an HTTP PUT request with the same URL. And to remove it, you can send an HTTP DELETE request using the same URL again.
Mohit jain
source share