Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Jun 29, 2020 09:04 AM
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(I...))&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.
Solved! Go to Solution.
Jun 29, 2020 12:15 PM
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.
Jun 29, 2020 09:16 AM
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:
Jun 29, 2020 12:15 PM
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.
Jun 29, 2020 10:38 PM
@Bill.French Thanks a lot sir now it’s working fine when I implemented quotes around the date! I really appreciate your quick response :thumbs_up: :thumbs_up:
Jun 30, 2020 07:43 AM
Excellent, but please mark this solved by @JonathanBowen as he assessed the true cause.