Help

Re: How to extract actual file from attachment field

341 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Sri1
6 - Interface Innovator
6 - Interface Innovator

Hello

I am developing a Airtable Script and I am looking for extracting actual file object which is part of the attachment field in a table. I got the object using record.getCellValue("Attachment field"). This object has information like URL, Filename, MIME etc. 

But what I am looking for is to extract the actual object in the attachment field (this could be a JPG, TXT,PDF,video etc). I need to pass this object to be stored in the target system through API (Dropbox API). The upload API in the target is looking for an object which is stored in local system.

As the object is in Airtable I am not sure how this can be passed to API.

The API call is some thing like below

-----------------------------------------------------------------------------------------------

let appToken = <-- Dropbox App token -->
// set up the post options
let postOptions = {
method: "POST",
headers: {
"Authorization" : "Bearer " + appToken,
"Dropbox-API-Arg": {
"autorename": false,
"mode": "add",
"mute": false,
"path": "/myairsri/" + flname,
"strict_conflict": false
},
"Content-Type" : "application/octet-stream"
//"Accept" : "application/json"
},
data<--- File object to upload ----->
}
const postResults = await remoteFetchAsync(dropboxEndpoint, postOptions);
---------------------------------------------------------------------------------------------------------
When I use the URL from getCellValue as "data", this call is returning a blank object no error or information
Not sure where it is going wrong
Please suggest.
Thanks
Sri
1 Reply 1
immesoete
5 - Automation Enthusiast
5 - Automation Enthusiast

Hey Sri, did you ever figure this one out? I'm stuck; same exact problem!
Best,
Cam