Jun 03, 2022 04:12 AM
if it is possible to post an attachment (.txt file) to an Airtable record (base / table / record / field) directly via API or do we need to post URL and let Airtable download from URL, and if so, what hosting / URL services to people generally use… such as box or google drive… is there a simple / temp host for URL for Airtable?
Another question:
Can we send a .txt directly to Airtable, or can you only send a URL for Airtable to download the file from?
Jun 03, 2022 05:15 AM
This. You must use a public url for attachments. If you have the raw file contents you must first use a service that will host the file at a public url and then use the url to make the attachment, even if the file is plain text.
Jun 04, 2022 07:12 AM
And there is a way to overcome this without using Box or Drive, etc; it’s just ugly as heck.
In Autocode, build a web service that sustains your text blob for 60 seconds (they have examples of this). Then (in Airtable script or any scripting environment for that matter) call that service passing your text. It will return a signed URL that’s valid for 60 seconds. Then hand that URL off to Airtable as you save the attachment field. It works very well and it’s really fast but it does require a trip around the barn.
I’m surprised mini-extensions (and even Airtable) have not created such a temporary URL proxy service but I guess there could be a boatload of content security issues depending on your use case. BTW - this also works for images, videos and just about any file type. The free tier of Autocode is typically all you need.