on 01-06-2021 3:48 PM
This is my data-model.cds:
entity Authors : {
key ID : UUID;
name : String(111);
books : Association to many Books on books.author = $self;
}
entity Books : {
key ID : UUID;
author : Association to Authors;
title : String;
}
How can i get JSON with oData query to group all books under each author?
So for example for author "John Doe" i will get all related books and for "Emily" all of her books?
Heres the wanted result:
{
"John Doe": [
{id:1,title: "first book"},
{id:2,title: "second book"}
],
"Emily ": [
{id:3,title: "Harrry poter"},
{id:4,title: "second Harrry"}
]
}
You can use the $expand parameter for this: Serving OData APIs
EDIT: add link to the documentation
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
9 | |
9 | |
8 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.