How to search Airtable database using URL parameters?

I’m trying to search my Airtable base using the API. I want to use the filterByFormula parameter in the URL to find specific data. Here’s what I’ve tried:

api.airtable.com/v0/APPID/Stories?filterByFormula=(FIND("Car (in robot form) will offer a hug when I am stressed out",{User want}) &api_key=MYKEY

But I’m getting an error:

{
    "error": {
        "type": "INVALID_FILTER_BY_FORMULA",
        "message": "The formula for filtering records is invalid: Invalid formula. Please check your formula text."
    }
}

I’ve been testing this in Postman. Can anyone help me figure out what’s wrong with my formula? How can I correctly filter my Airtable data using the URL?

hey there! i’ve run into similar issues before. looks like ur missing a closing parenthesis in the formula. try this:

api.airtable.com/v0/APPID/Stories?filterByFormula=FIND(%22Car%20(in%20robot%20form)%20will%20offer%20a%20hug%20when%20I%20am%20stressed%20out%22%2C%7BUser%20want%7D)&api_key=MYKEY

make sure to URL encode special characters too. hope this helps!

I’ve encountered this issue before. The problem lies in the URL encoding and formula structure. Here’s a corrected version:

api.airtable.com/v0/APPID/Stories?filterByFormula=FIND(%22Car%20(in%20robot%20form)%20will%20offer%20a%20hug%20when%20I%20am%20stressed%20out%22%2C%7BUser%20want%7D)%20!%3D%200&api_key=MYKEY

This formula checks if the specified text is found in the ‘User want’ field. The ‘!= 0’ part ensures it returns true when found. Remember to replace APPID and MYKEY with your actual values.

Also, consider using a URL encoder to handle special characters properly. This should resolve your filtering issue.

Over my years of working with Airtable’s API, I found that errors in the filterByFormula parameter often come from slight syntax issues. In this case, using the SEARCH function instead of FIND can help, especially when you need case-insensitive matching. One approach to try is:

api.airtable.com/v0/APPID/Stories?filterByFormula=SEARCH("Car+(in+robot+form)+will+offer+a+hug+when+I+am+stressed+out"%2C+{User+want})

Be sure to encode all special characters correctly and avoid adding extra closing parentheses. Testing your requests with a tool like Postman can also help ensure that your URL is properly formatted.