Back to Listing

Pull One-2-Many relations on API GET

When retrieving entities (rows) with these: /tables/[table-name]/rows /tables/[table-name]/rows/[id] it would be nice to have the option to include all One-2-Many rows in the response.

Example: Let say I have a Table "Book" and a table "BookCategory". I then define a typical Many-2-One field in "Book" pointing to "BookCategory". So every time I add a book, I specify the Category. Pretty straightforward. I also add (because Directus somehow needs it) the One-2-Many relation from Book_Category to Book. What I think it would be useful is to have the ability to pull the Categories, and have each of them come with the list of books they include.

Of course this should be optional to avoid performance problems.