Date range filter with other filters on API call is not working kindly help me out to solve this problem

I have integrated the Airtable API in my Wix site which was working fine with other filters but when I implemented date range filter with those filters then it’s showing empty items in response and here is the URL of my request
https://api.airtable.com/v0/appGS7oZJd8MLqWKc/Candidates?filterByFormula=AND(({City}=‘Benton’),AND(IS_AFTER({Date_of_Submission},2020-06-03),%20IS_BEFORE({Date_of_Submission},2020-06-29)))&api_key=“key_provided_by_airtable”.
I checked that on Airtable data UI by applying the same filter and it’s working fine over Airtable UI but not working in API calling when I applying the same filter via API.

Hi @James_Rodriguez - you need to quote your dates, so instead of this:

&filterByFormula=IS_BEFORE(%7BDate%7D%2C2020-06-15)

do this:

&filterByFormula=IS_BEFORE(%7BDate%7D%2C%222020-06-15%22)

Not sure of you have some across this, but you can use this codepen to encode your API urls:

Hi @James_Rodriguez and welcome to the community!

Just to be clear, filterByFormula parameters MUST be URL-encoded. Dates without quotes is one issue; lack of URL-encoding is another.

Typically your scripting environment where you make the API calls will provide a method for URL-encoding and some languages refer to it as URI-encoding.

@Bill.French Thanks a lot sir now it’s working fine when I implemented quotes around the date! I really appreciate your quick response :+1: :+1:

Excellent, but please mark this solved by @JonathanBowen as he assessed the true cause.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.