appsmithorg / appsmith

Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
https://www.appsmith.com
Apache License 2.0
34.55k stars 3.73k forks source link

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

Closed GreenFlux closed 8 months ago

GreenFlux commented 1 year ago

Is there an existing issue for this?

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 commented 1 year ago

cc @spark-c

spark-c commented 1 year ago

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"
      }
    }
  ]
}
GreenFlux commented 1 year ago

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?