Parent / Child Endpoint Best Practice

In designing API endpoints for something like an order or invoice, is it better to have endpoints for Order and Item

eg.

public class CreateOrder
{
public DateTime OrderDate { get; set; }

}

public class CreateOrderLineItem
{
public int OrderId {get;set;}
public int ProductId {get; set }

}

or single payload

eg.

public class CreateOrderEntry
{
public DateTime OrderDate { get; set; }
public List<LIneItem> LIneItems {get;set;}

}

I’d definitely only have a single API which takes an Order + multiple LineItem’s, how they’re stored is a matter of preference within your Service implementation.

I’d personally use POCO Reference support to be able to store Order + related Line Items using the POCO references support in Save, e.g:

db.Save(order, references:true);