Let's say I have two entities
public class Container {
UUID id;
String name;
@OneToMany
List<Element> elements
}
and
public class Element {
UUID id;
String name;
@ManyToOne
Container container;
}
What would be the best approach to designing a REST API for these entities? For example should Elements be added to the container via a Container endpoint or via Element endpoint? Or when creating a new container should the Elements be created with the Container in a single request or in a separate request and subsequently added to the Container in another request? Should I have an endpoint to create multiple elements at once?