Hi
I am trying to upload files (pictures with .jpg extension) to my dropbox account (to a specific app folder). I am using Airtable scripting (Javascript) extension to upload files from Airtable (which has these pictures as attachments)
As these attachments are in Airtable (available at individual URLs), I am using below dropbox URL
When I use Dropbox API explorer it is able save the file to the dropbox folder.
But when I use through Airtable scripting block I am getting below error,
"Error in call to API function "files/save_url": request body: could not decode input as JSON"
main part of the script attached below
--------------------------------------------------------
// set the endpoint and app token
let dropboxEndpoint = "https://api.dropboxapi.com/2/files/save_url";
let appToken = "<--my dropbox app token -->"
// set up the post options
let postOptions = {
method: "POST",
headers: {
"Authorization" : "Bearer " + appToken,
"Content-Type" : "application/json"
},
data: {
"path":"/myairsri/best_peacock.jpg",
"url":"<-- Airtable attachmet URL -->"
}
}
const postResults = await fetch(dropboxEndpoint, postOptions);
const jsonPost = await postResults.text();
console.log(jsonPost) ----------------------------------------------------
Please suggest how this can be resolved.
Thanks
Sr