Using invokeurl to upload files to Google Drive
I'm running into an issue when using invokeurl to attempt to upload files to Google Drive using the Google Drive API v3
When I run the code below I get this error: "Missing end boundary in multipart body"
However, I define the boundary string in the header, and include it in the parameters string.
When I run the same request in Postman, I get a successful response and it creates the file. Postman pics are attached.
How do I need to format this request in Deluge to get it working?
upload_headers = Map();
upload_headers.put("Content-Type","multipart/related; boundary=foo_bar_baz");
// upload_headers.put("Content-Length",file_size);
upload_params = "--foo_bar_baz"+"\n"+"Content-Type: application/json; charset=UTF-8"+"\n"+"{'name':'Zoho_test.txt','parents':['1ZfH6_HIkH1AH5liITcIUqxiR92KzOByY']}"+"\n"+"--foo_bar_baz"+"\n"+"Content-Type: text/plain"+"\n"+"This is a test document."+"\n"+"--foo_bar_baz--";
//Upload PDF HTTP request
//
upload_PDF_response = invokeurl
[
url :upload_PDF_url
type :POST
headers: upload_headers
parameters:upload_params.toText()
connection:"zohogdrive"
];
info upload_PDF_response;