Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Oct 04, 2021 09:55 PM
I was wondering if it’s possible to add multiple filters in the Airtable API URL - I have figured out the way for one filter, but I am struggling to apply multiple filters. Here’s the URL I made, which has a single filter applied :
api.airtable.com/v0/<BASE_ID>/<TABLE_NAME>?api_key=<API_KEY>&filterByFormula={City}="MUMBAI"
The above URL works perfectly, but if I try to add another filter (using &
), it shows errors.
I am looking for a way to add these 3 filters :
What is the recommended/correct way to add multiple filters? Your guidance would be very appreciated. Thanks!
Solved! Go to Solution.
Oct 05, 2021 03:34 AM
Hi Kartik,
yes, that’s possible.
You can have only one filterByFormula parameter.
But you can treat filterByFormula just like a regular Airtable formula field.
You could try it like this:
&filterByFormula=AND({City}="MUMBAI",{Age}>25,{Calculation}="Ok")
Quick tip: if you are unsure about whether your formula will work, just create a new Airtable formula field and test it there. I often find this a quicker way to spot errors in a formula than debugging it with API calls.
This is also a good tool to automatically create properly encoded urls with the correct parameters.
Oct 05, 2021 03:34 AM
Hi Kartik,
yes, that’s possible.
You can have only one filterByFormula parameter.
But you can treat filterByFormula just like a regular Airtable formula field.
You could try it like this:
&filterByFormula=AND({City}="MUMBAI",{Age}>25,{Calculation}="Ok")
Quick tip: if you are unsure about whether your formula will work, just create a new Airtable formula field and test it there. I often find this a quicker way to spot errors in a formula than debugging it with API calls.
This is also a good tool to automatically create properly encoded urls with the correct parameters.