Apologies for the confusing title, I struggled to find a better way to describe it.
Imagine sending a GET request to an API and receiving this data:
{
{id: 1, name: "John Doe", tags: ["Apple", "Orange", "Pear"]},
{id: 2, name: "Jane Doe", tags: ["Grape", "Banana", "Strawberry"]},
{id: 3, name: "James Smith", tags:["Grapefruit", "Lemon", "Apricot"]}
}
If I wanted to delete the entire second object, I could use a similar approach as follows:
var request = new XMLHttpRequest();
request.open('DELETE', APIurl + "/2", true);
request.send();
However, if I only want to remove the "Banana" tag from the second object, what would be the most efficient method? One option might involve deleting the object entirely and then adding it back without the specific tag, but I wonder if there's a simpler solution available?
As someone with limited experience in working with APIs, I seem unable to solve this matter using online resources. Any help would be greatly appreciated. Thank you!