Help

A (more secure) API for exporting CSVs

1152 2
cancel
Showing results for 
Search instead for 
Did you mean: 
GavinA
8 - Airtable Astronomer
8 - Airtable Astronomer

In this thread I demoed an API for exporting your base in CSV format. The main issue is that it requires credentials to be passed as visual parameters in the URL.

I’ve overcome this by making a new endpoint which accepts a POST request to store the sensitive information securely. A successful POST request will return a link for downloading your base as CSV which does not show any keys in plain sight. This link will only need to be generated once and will always show the latest data of the chosen table when used. It will be great for analysis, scheduled backups, or sharing a specific table with a client who wants access to live data by CSV.

Post requests can be done in terminal like so:

curl -X POST -F 'base=your_base_id' -F 'apik=your_api_key' -F 'table=your_table_name_or_id' -F 'view=your_view_name_or_id' 'https://csv-getter-for-airtable.ew.r.appspot.com/v2/make-url'

Or you can use a tool like https://www.postman.com (required parameters made clear in the doc). If there proves to be demand, I can build out a simple webapp for easily performing these post requests.

The generated link will be of the format:

{ 
	"URL":"https://csv-getter-for-airtable.ew.r.appspot.com/v2/all-csv/unique-id"
}

Docs here for help. For any specific questions about how keys are stored or how data is handled, please reach out.

2 Replies 2
GavinA
8 - Airtable Astronomer
8 - Airtable Astronomer

Very exciting product update! - Filtering and column ordering

Column ordering
You can now order your columns by attaching the ‘cols’ parameter to your unique URL:
i.e
<your_unique_url>?cols=x,y,z
Or
<your_unique_url>?cols=y,x
etc.

And the introduction of an equals filter parameter: ‘equals’
i.e

<your_unique_url>?equals=date|2021-01-01 (no spaces)

This will only show data from the base where the field date equals 2021-01-01

Example
curl "<your_unique_url>" (generates full base)

Day----------Sales----- Profit
Monday--------3----------- 3
Tuesday--------5-----------6

curl "<your_unique_url>?cols=Profit,Sales&equals=Day|Tuesday"

Profit----Sales
—6---------5

Make sure you understand how to list parameters in a URL: i.e
?param1=value1&param2=value2 etc....

And as always, for any help or questions, please checkout the docs or reach out

GavinA
8 - Airtable Astronomer
8 - Airtable Astronomer

This post request has now been replace with an easy to use, no-code version found here