For a home automation project I needed to upload files to Google Drive v3. I use Node-RED together with Home assistant for adding “intelligence” to my home automation. My HP printer has a feature to scan documents to email. I wanted to use this feature to scan documents and automatically upload them as PDF to Google Drive. Within Node-RED the http request node is the obvious choice to accomplish this, but I found it challenging to get it uploading multipart-encoded payloads.
In this post I will show you how to use the Node-RED http request node to upload a file to Google Drive using the v3 API, using a multipart-encoded payload.