Skip to main content

Airtable query (GET) filter with json (non relational) data


I am making a GET request to an airtable collection (the data has the form of a list of jsons).

I am trying to add a filter according to the documentation but because my data is not relational but json-like, I can’t access the fields inside the records.

With an example:

The simple GET output:

{
    "results": [
        {
            "id": "12345",
            "date": "2022-04-14T05:14:16.000Z",
            "info": {
                "username": "random1" }, 
        {
            "id": "123456",
            "date": "2022-04-13T15:14:16.000Z",
            "info": {
                "username": "random2" }]
}

I would like to filter the date and/or usernames, doing something like:

https://api.airtable.com/v0/myBase/myTable?filterByFormula={results}{date}>“2022-04-13”

Thanks!

3 replies

kuovonne
Forum|alt.badge.img+17
  • Brainy
  • 5996 replies
  • April 15, 2022

Welcome to the Airtable community!

If you are accessing the REST API, I recommend using the documentation at https://api.airtable.com. It is much more complete. To filter the results from the REST API, the value for filterByFormula needs to be a valid Airtable formula (url encoded). This works best if you build the formula first in an Airtable formula field. The query you include in your example does not look like a valid Airtable formula.

Also, the results that you show in your post do not look like the results of the public REST API for Airtable.


  • Author
  • New Participant
  • 3 replies
  • April 19, 2022
kuovonne wrote:

Welcome to the Airtable community!

If you are accessing the REST API, I recommend using the documentation at https://api.airtable.com. It is much more complete. To filter the results from the REST API, the value for filterByFormula needs to be a valid Airtable formula (url encoded). This works best if you build the formula first in an Airtable formula field. The query you include in your example does not look like a valid Airtable formula.

Also, the results that you show in your post do not look like the results of the public REST API for Airtable.


Thanks kuovonne.

About the query, I wrote it as an example, I am trying to get a valid one.

About the results, they are definitely what I get when I query Airtable, so maybe I am not doing the query right, my URL is: f"https://api.airtable.com/v0/{AIRTABLE_BASE_ID}/{TABLE}" and I am doing a simple GET.


  • Author
  • New Participant
  • 3 replies
  • April 20, 2022

Could you provide an example of what the results of the public REST API look like?


Reply