appsmith icon indicating copy to clipboard operation
appsmith copied to clipboard

[Bug]: Airtable - "fields" query param is not being passed to API properly, does not filter fields returned

Open GreenFlux opened this issue 2 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

In the Airtable query settings, the Fields input should accept an array of strings, and pass that to the API to filter the fields that are returned. However, the input either causes an error (when passing an array of strings) or is ignored (when passing a string).

The error when passing an array shows the resulting request URL:

Illegal character in query at index 65: 

https://api.airtable.com/v0/BASE_ID/TABLE_ID?["test"]&filterByFormula=&maxRecords=&pageSize=&&view=&cellFormat=&timeZone=&userLocale=&offset=0

This shows that the fields param is being passed without a key, and the array is not being url encoded. Adding the fields= before the param value, and url encoding the value should fix this issue.

Steps To Reproduce

  1. create an API key from your Airtable account
  2. create an Airtable datasource in Appsmith
  3. add a List records query and test that it is working
  4. try adding an array or string of field name(s) to the Fields input
  5. observe that the fields are not filtered when using a string, and that the API fails when using an array.

Public Sample App

No response

Environment

Production

Issue video log

No response

Version

Appsmith v1.9.12-SNAPSHOT

GreenFlux avatar Mar 14 '23 11:03 GreenFlux

cc @spark-c

GreenFlux avatar Mar 14 '23 11:03 GreenFlux

It seems like there might be a similar problem with the sort parameter; I hadn't tested it much at the time, but right now my results are coming back in the same order regardless of sort. Example:

// Sort field = employee_id
{
  "records": [
    {
      "id": "recdo8NkX4ucvnXIy",
      "createdTime": "2023-03-14T14:10:46.000Z",
      "fields": {
        "name": "Ashley Hatter",
        "date_of_birth": "1993-06-05",
        "employee_id": 1005 // out of order
      }
    },
    {
      "id": "rectV0sV07e04PfTR",
      "createdTime": "2023-03-13T15:11:26.000Z",
      "fields": {
        "name": "Sarah Carne",
        "Done": true,
        "employee_id": 1003,
        "date_of_birth": "1989-04-05"
      }
    }
  ]
}

spark-c avatar Mar 14 '23 14:03 spark-c

Another user on Discord is facing this issue. https://discord.com/channels/725602949748752515/778949891014656050/threads/1113278316556853338

@rohan-arthur could I get an update on a fix for this please?

GreenFlux avatar May 31 '23 10:05 GreenFlux