Skip to main content

List records API with filterByFormula

  • May 30, 2023
  • 1 reply
  • 5 views

Forum|alt.badge.img

Hello,

I have a working API to list the records from base. When I test from postman with below URL, it returns the data as expected

URL: https://api.airtable.com/v0/app123/Locations?view=LocationDetails&api_key=2345

{ "records": [ { "id": "12345", "createdTime": "2023-05-30T15:23:34.000Z", "fields": { "Location": "ABC1", "Record Creation Date": "2023-05-30T15:23:34.000Z" } }, { "id": "12346", "createdTime": "2023-05-16T15:23:34.000Z", "fields": { "Location": "ABC2", "Record Creation Date": "2023-05-16T15:23:34.000Z" } } ] }

I would like to add a condition to filter out response based on field (i.e: Record Creation Date) from base.

E.g: I would like to get the response from API to only return entries where (Record Creation Date > 2023-05-16T15:23:34.000Z) which should only return 1 entry

How can I update my URL ?

1 reply

kuovonne
Forum|alt.badge.img+27
  • Brainy
  • 6001 replies
  • May 31, 2023

The first step is building the formula in Airtable itself. It sounds like the IS_AFTER() formula would work for you. Then once you have the formula working the way you want, you can urlencode it as the value for the the filterByFormula parameter.

IS_AFTER({Record Creation Date},DATETIME_PARSE("2023-05-16T15:23:34.000","YYYY-MM-DDTHH:mm:ss.SSS"))


Reply