If I have a "Bill" entity, I might create that bill instance via REST API by assigning the food ordered to the bill when I go to create a new bill.
i.e. I might make a POST request to www.server.com/api/bills with following parameters:
{
cost: 30.0,
foods: [23, 1, 14]
}
Is it better to send an array of ids or is it normal practice to send an array of objects? Like the following:
{
cost: 30.0,
foods: [
{
id: 23,
name: "Chicken Parmesan",
price: 10.0
},
{
id: 1,
name: "Scotch Fillet Steak",
price: 10.0
},
{
id: 14,
name: "Baramundi",
price: 10.0
},
]
}
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)