Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Re: How to filterByFormula a record with an email

1713 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Nicolas_Monnier
4 - Data Explorer
4 - Data Explorer

Hi there,

I have a table that have records of users_email and i wanted to implement a get_by_email method from my server.

I must have missed something because I can’t get the filterByFormula to work…
I’m trying this in python:
payload = {“filterByFormula”: “({EMAIL} = "test@test.fr”)"}
r = requests.get(url, params=payload, headers=headers)

In returns i have this error :
{‘error’: {‘type’: ‘INVALID_FILTER_BY_FORMULA’, ‘message’: ‘The formula for filtering records is invalid: Invalid formula. Please check your formula text.’}}

Can someone help on this please ?
I’m a little lost
Thanks in advance :slightly_smiling_face:

3 Replies 3
Andrew_Johnson1
8 - Airtable Astronomer
8 - Airtable Astronomer

Did you URL encode your request?

Yes requests does it by itself

Giovanni_Briggs
6 - Interface Innovator
6 - Interface Innovator

Only thing I can think of is that you aren’t escaping your double quotes around "test@test.fr." The following works for me:


url = "https://api.airtable.com/v0/appID/tableID"

querystring = {"filterByFormula":"({EMAIL}=\"example@example.com\")"}

headers = {
    'Authorization': "Bearer airtableAPIkey",
    }

response = requests.get(url, headers=headers, params=querystring)

print(response.text)

Alternatively, you can use single quotes:
querystring = {"filterByFormula":"({EMAIL}='example@example.com')"}