REST web services

HI,
I have heard about rest but dont know exactly what it is. I have written a small application which just inserts data into db and you can modify it and query it using an id with db. In  the controller i am having the following methods :

[i]This methods open a new window UI where one can enter some data[/i]
 @RequestMapping(value = "/")
    public String newSnippet(HttpServletResponse response) throws IOException {

[i]This method inserts the data entered by user into Database[/i]

    @RequestMapping(value = "/snippets", method = RequestMethod.POST)
    public void createSnippet(@RequestBody String jsonString, RedirectAttributes redirectAttributes,HttpServletResponse response, HttpServletRequest request) throws IOException {

[i]This we can query data using an id.[/i]
 @RequestMapping(value = "/snippets/{id}", method = RequestMethod.GET)
    public ModelAndView showSnippet(@PathVariable String id) {

[i]This is used to update data in db[/i]
@RequestMapping(value = "/snippets/{id}", method = RequestMethod.PUT)
    public void showSnippet(@RequestBody String jsonString, @PathVariable String id, HttpServletResponse response) {

[i]This is called when user clicks on edit button so he can edit data[/i]
    @RequestMapping(value= "/snippets/{id}/edit", method = RequestMethod.GET)
    public ModelAndView editSnippet(@PathVariable String id){

[i]This displays the user data corresponding to id in a raw form[/i]
@RequestMapping(value="/snippets/{id}/raw", method=RequestMethod.GET)
    @ResponseBody
    public String rawSnippet(@PathVariable String id, HttpServletResponse response){

Open in new window


Are the above in compalince with REST ? If not how do i restify it ?
What exactly is REST and why is it so important ?

Thanks
Rohit BajajAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dpearsonCommented:
To most people a REST api just means a web service.

But more technically it really comes down to making sure that you honor the HTTP verbs (PUT, GET, DELETE etc.) in the "correct" way - which in turn means making sure for instance that GETs are always repeatable (they never change state) etc.

If you get that straight then you can go for even more of a REST API if you allow it to be discovered (one call returns data that is used in subsequent calls) but that level of restfulness is largely academic.  Just focus on making sure all of the verbs are used correctly.

More here:
https://en.wikipedia.org/wiki/Representational_state_transfer

and here:

http://www.restapitutorial.com/lessons/httpmethods.html

Specifically read the details on each verb and what it should logically be doing in the system.

Doug

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.