Alright, my URL(example.com/api/content/12) returns JSON data in the following format:
{
"title" : "My blog post",
"body" : "Body",
"data" : "old"
}
I want to simply make a change to the data field only. Currently, I am using PUT and basically just replacing the whole thing, which I realize is ineffecient. Something like this:
var data = {
"title" : "My blog post",
"body" : "Body",
"data" : "New data"
}
$.ajax({
url: 'http://example.com/api/content/12',
data: data,
error: function() {
console.log('Error');
},
dataType: 'json',
success: function(data) {
console.log('success');
},
type: 'PUT'
});
How do I do this with PATCH? I dont really need to send the title and body fields as they do not change. I just want to update the data field.