I was wondering if there is any way for the JS API to update an object without actually retrieving it. For example, update a field in an object of which i know its objectID or other field value i set.
update status = ‘ok’ where id = 2301.
If not, can it be done through REST?
Having to retrieve a whole object to change a field is quite inefficient in terms of network traffic and latency, as it involves the step of retrieving and then save (update).
Object update in REST does not require object retrieval. However, you need to know objectId in order to update it:
http://backendless.com/documentation/data/rest/data_updating_data_objects.htm
Regards,
Mark
I want to update a object in JavaScript, i try this:
$.ajax({
url: “https://api.backendless.com/v1/data/Foto/”+fotos.data[imagenesCount].objectId,
headers: {
“application-id”:“2C0500B9-4F81-1EEB-FFA0-2E11429BF100”,
“secret-key”:“2442562C-C257-ADAF-FFA1-D488F8E24400”,
“Content-Type”:“application/json”
},
type: “PUT”,
data: {
repeticiones: fotos.data[imagenesCount].repeticiones+1
}
});
but the error is: https://api.backendless.com/v1/data/Foto/403C0EE8-4C7D-BFD4-FF18-B789933E2400 400 (Bad Request)