Google drive API upload file

Hi guys,

I have an API action that handles a few things and should upload using an API call a file to google drive. So far so good but i always get an empty file. I am pretty sure it is the way the binary content is managed by the api call. The data is received in the api action from a simple form with an input file. In the api action inputs i have entered an object variable fileToSend and modified the call of the API call like that :

{
“name”: “api”,
“module”: “api”,
“action”: “send”,
“options”: {
“method”: “POST”,
“url”: “https://www.googleapis.com/upload/drive/v3/files?uploadType=media”,
“headers”: {
“Authorization”: “{{'Bearer '+get_tokens[0].access_token}}”,
“Content-Type”: “{{$_POST.fileType}}”
},
“data”: “{{$_POST.fileToSend}}”
// I have tried with “body”: “{{$_POST.fileToSend}}” same result
},
“output”: true
}

Thank you

The problem is Wappler has imperfect handling of file data. You’ll probably need to use a custom extension for API Action with file upload support

1 Like

for now i created a front end API call which will be fine for testing but yes I will definitely need to find a better solution when going for production