Let's say I have two models in SqlAlchemy:
UserType
User
User
has a foreign key to UserType
I have properly configured flask-restless to serve these models as API endpoints:
/api/user
/api/user_type
But by default, when I visit either of these endpoints, I get the related data associated with each object in the response:
- Each
User
has the correspondingUserType
object nested in the response - Each
UserType
has a collection ofUser
nested in the response
This will definitely lead to a lot of overhead as the data grows a lot. If I just want to GET the list of UserType
that the system supports, all of the associated users will come back. Usually an API would generate a link for related resources:
/api/user/1/user_type
/api/user_type/1/users
Has anyone gotten these links out of flask-restless responses?