Say I have a Student who has a ID number, a name, a profile picture, some contact details, and is enrolled in several courses.
From the perspective of a Single Page Application there are different scenarios where I might want to see different views of this student object.
- An admin page might want to see the student, and their contact details.
- A yearbook just wants the student and their profile picture.
- A profile page wants the student and the list of courses they are enrolled in.
- A grades page wants the student, and the list of courses they are in, and the grades for those courses.
Where this question is relevant is mostly on the 'and the courses they are enrolled in' questions - where, on the backend this involves some kind of multiple table joins and formatting.
The question is - what is the RESTful way of doing this/what REST principles should I adhere to?
For example, is the right way to do this, to just declare several endpoints like: