Search code examples
restgrails

How to implement REST controller in grails


I used to do Grails applications where controllers return some model to the view. Now, I have to create the REST web service, which will accept and return the data in JSON or XML format. I want to map it to some URL resource as well.

Please give me some bits of advice (plugins, the code snippets)

Thanks in advance


Solution

  • Read up on the grails restful api plugin

    http://grails.org/plugin/restful-api

    It is very thorough and well documented

    Or, if you just want a simple REST api, you can use the built in method for return json from your controller.

    http://grails.org/doc/2.2.1/guide/webServices.html