I have a user object where I want to add a new friend onto their existing friends list. If below is the existing friends list for user1 , how would I POST/PUT a new friend onto that existing list without reposting the whole friends list.
{
"friends": [
{
"first_name": "Bob"
},
{
"first_name": "Dave"
},
{
"first_name": "Jon"
}
],
"first_name": "User1",
}
What would my JSON look like in the POST and what do I have to do on the DRF end to allow me to update this array without reposting the existing array.
I tried to POST the following but it just overwrote the entire friend list
PATCH /api/profile/55522221111/ HTTP/1.1
{"friends":[{"first_name":"new friend"}]}