When uploading a PDF file from Quickbooks new invoice trigger, the file size is 0
Follow Zapier hydration sample code (https://github.com/codebycaleb/zapier-hydration-example/ ) to upload a pdf file from new Invoice trigger for Zapier-Quickbooks integration, but getting file size is 0 - an empty file with the name "invoice_{number}.pdf
How to handle this case?
Page 1 / 1
Hi Jonathan, all you have to do is post directly to the QuickBooks Endpoint using FormData, while using request to download the file from a Zapier file field (or URL field). Example:
const request = require('request'); const formData = new FormData(); let file = bundle.inputData.file; let filename = bundle.inputData.filename; let url = "https://quickbooksApI_Endpoint.com"; formData.append('file', request(file), {filename: filename}); return z.request({ url: url, method: 'POST', body: formData }).then((response) => { response.throwForStatus(); let result = JSON.parse(response.content); return result; });
Let me know if that works.
Thanks for your help.
Since I do not upload file to Quickbooks, the “url” points to my service. Using this way, I got the “hydrate” as content - this is incorrect as shown below: