How to use REST API to delete up to ten records at a time using Node.js library axios?

Topic Labels: API
Jump to Solution
8243 11
Showing results for 
Search instead for 
Did you mean: 
6 - Interface Innovator
6 - Interface Innovator

How do I use the REST API to delete ten records at a time using axios?

I can successfully delete one record at a time, but due to the API design, I am having a problem constructing the URL to delete ten at a time.

Here is what works with one record at a time:

I am using a library in Node.js called axios to do HTTP method calls, and here is the call that works:

await axios.delete(url, {params: params, headers: headers})
	.then(async function(response) {

I define params this way (I have a method call that returns the params to send to axios)

params = await getParams(rec);  // rec is the Airtable record identifier like: `rec
async function getDelParams(rec) {
    const params = {
        'records[]': rec		// rec is like: rec5GWL8xCpofFKFC
    return params

In this key/value pair, I can only have one entry of : records[] , no more, I need ten.

The REST API requires multiple records like:


and so on, up to ten max.

but axios accepts params as a list of key/value pairs, and there can be only one key: records[] in the list.

I need key/value pairs because I have other keys/values that I am sending, and this makes it convenient.

How can I use axios/key value pairs to make this work so that it sends 10 at a time, instead of one at a time?

Follow up:

What could be done here (or what is typically done here) to design a better API to accept a list of values with one key?

11 Replies 11
5 - Automation Enthusiast
5 - Automation Enthusiast

Thank you very much for your help @Bill.French ! It was very easy to make it work based on your feedback on the expected syntax.

The JS object was not the issue here (we were not using the same key multiple times here), this weird syntax was (I’ve never seen such syntax for a delete API call for the 15 years I’ve been working with APIs).
Maybe there’s something to do in the documentation here to make that more obvious?


There’s an axiom in product development -

Do not surprise users unless it’s a delightful surprise.

This… ?records[]=rec6LzaDnlc2zcoYO&records[]=recCCdy6JKlSxyGMC is a surprise but not delightfully so. :winking_face: