rest - Rails: How to parameterize access to a RESTful resource? -
I am looking for a comfortable way to pass through options in a service. Now I have a standard device that has standard rail Is available in:
map.resources: devices ,: member = & gt; [: Historical]
So I can get my device from / devices /: id
and I can not get the value of / devices /: id / historical < / Code>
I really want to add an absolute to the historical URL which specifies a threshold, so when I ask for historical data, then I am per hour, daily, weekly, month. / devices /: id / historical /: range
Is there a way to set it up to be the way to adjust it? Or do I just call it / devices /: id / historical? Range = hourly
, but I'm not sure whether this is breaking frightening conventions or knowing about what is best.
I think your question really is how to know when it is a resource As is appropriate to represent something and parameter it using the query string.
I do not know your domain, but with your question it appears that there is a historical data processing about the device and based on that data, the best query string Is displayed, in the same way that you can endorse a large list of items.
There is more caching to consider, because if you want page cache, each category is different, then you must use path sections within the path such as : category
In this way the railroad will generate a unique HTML file on the disk to represent that category. If you use a query string, it will be effectively ignored and the same HTML file will be returned for different categories.
Comments
Post a Comment