My question is very simple, i am designing an Aplication(In Ruby on Rails BTW) that will also have a RESTful API to it.
During the design of the application I came into the problem of what is a resource in: "download an image".
I found 2 options:
Have a controller named ImagesController and a show action that actually returns the file to be downloaded.(GET request)
Have a controller named ImageDownloadsController and a create action!(POST request)
The reason why I choose the second one is because for me a show action of images controller would make more sense to return the image url to be shown on the browser or the template with the image already.
Also because when I design the API, I think it will be easier and make more sense that it matches the most of my application. What I mean is that the API is faithful to what I designed on my APP. So that the controller actions on the API matches most of the ones on the APP.
I think it can be a problem for the sake of design that my APP on ImagesController#show returns a file and that on my API it returns an URL.
Instead I would like to have on my APP a controller called ImageDownloadsController where create returns the file. And on my API a ImagesController where show returns the url! I still dont like the name ImageDownload for a resource!
I would like to hear your thoughts on this, and why do you think one option is better than the other if possible.