Bulk record update

Here I have a code to update ONE record:

$.ajax({
	url: "https://api.knackhq.com/v1/objects/object_1/records/" + record_id,
	type: "PUT",
	headers: my_headers,
	data: {
		field_1 : value_1,
		field_2 : value_2,
		field_3 : value_3
	},
	success: function(response) { 
		console.log("Done!");
	}
});

 

But I have to update 700 records. Is there a way to make a bulk update with the fewest requests number possible? I mean, do more than one request per request.

Hi, not sure if I understand correctly but believe what you need is a loop to iterate through all your records?, something like:

for (var i = 0; i < data.total_records; i++) {

data: {

field_1 : value_1, field_2 : value_2, field_3 : value_3

},

}

 

or perhaps write a variable in the URL ... you need someone that can code JS/AJAX :)

Any chance you could post a simple example of the code you are referring to? Or a link to a tutorial for those of who are still learning :slight_smile:

Thanks!

I normally use Tasks... you set a condition and execute... :)

I have been trying to figure out a way to do bulk updates as well and am very interested if you were able to get this to work. Any progress?

Can you do it with a filter?
I.e. Use a filter to update all the records at once instead of one record at a time.

I haven’t tried it but it’d be worth seeing if it works, and here’s the filters help page for API http://helpdesk.knackhq.com/support/solutions/articles/5000447623-filters-search