I am working with a Rails application that uses RESTful routes for handling it's resources. I am now creating a reports controller that will generate reports in HTML, XML, CSV, etc. There will be several different reports available for generation, depending on the parameters sent to the controller.
Is it overkill to use REST for this reports controller as it's not an actual resource that will be saved and then available for editing or deletion? Using RESTful would create a lot of routes that I will never need to use.
Would it be a better practice to define a custom route instead of going RESTful? Such as having a single generate action in the controller that generates the report and outputs it in the specified format?
map.connect 'reports', :controller => 'reports', :action => 'generate'
Your way is fine, or if you prefer to stick with the RESTful routes you can pick and choose the ones you want.
map.resources :reports, :only => [:show]
Sorry resurrecting such old post.
According to RESTful Web Services, you don't need to provide write-actions so your service can be considered RESTful.
As far as I know, you need to design your service using ROA (Resource-Oriented Architecture) and that's it.
That being said, @jdl answer was correct and RESTful. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With