4 ms·
I love the REST principles. The RESTful ideas framework (I call it like this because I lack a better name for them) helped me organize my applications in a much
by tudorconstantin 9y ago
I love the REST principles. The RESTful ideas framework (I call it like this because I lack a better name for them) helped me organize my applications in a much more consistent manner.
I wonder if a URI like http://api.college.com/students/3248234/courses/physics/students http://api.college.com/students/3248234/courses/physics/stud... would actually make sense to get a list of all the students who take the same physics course that student 3248234 takes. If yes, is there a web framework where such generic routes can be defined?
- andreareina 9y agoIf you're using the url as a hierarchical representation, it wouldn't make sense. What happens if you ask for a circular reference like /students/3248234/courses/physics/students/3248234? You can either query the student to get the course's uri, then access /courses/<course_id>/students.
- baddox 9y agoRuby on Rails easily supports arbitrarily nested resourceful routes, but they strongly (and wisely, in my experience) advise against precisely this type of deep nesting. http://guides.rubyonrails.org/routing.html#nested-resources http://guides.rubyonrails.org/routing.html#nested-resources http://weblog.jamisbuck.org/2007/2/5/nesting-resources http://weblog.jamisbuck.org/2007/2/5/nesting-resources