Skip to main content
Best answer

Zapier CLI Upload File to API URL


Hi, 

I am trying to upload a file to API endpoint, I am using form-data append method explained here: https://platform.zapier.com/cli_tutorials/hydration. But the issue I am facing is our API only support multipart binary file and Zapier is sending response from `request(file)`.

So is there any option to convert Hydrated File URL to get file path, so that I can send binary data to the API?

Thanks

Best answer by karan-fytechBest answer by karan-fytech

Hi all, 

If someone landed here for the solution: After digging a lot I have found the solution, the issue is caused by using latest versions of “form-data” and “request” repositories. So if you are having same issue just downgrade the above mentioned repositories to exactly: 

"form-data": "2.1.4",
"request": "2.81.0" // Most important

And do specify a filename parameter while appending file to formData like:

formData.append("file", request(bundle.inputData.file), {
    filename: bundle.inputData.name // This filename is important, if removed it will throw error
})

Regards,
Karan Singh Sisodia

View original
Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Danvers
Forum|alt.badge.img+12
  • Zapier Staff
  • 3731 replies
  • May 20, 2020

Hi @karan-fytech! It looks like you’ve also reached out to the Support Team about this one. They’re in the best position to help in this case, so please could you continue the discussion with them via email? Thanks! 


  • Author
  • Beginner
  • 1 reply
  • Answer
  • May 22, 2020

Hi all, 

If someone landed here for the solution: After digging a lot I have found the solution, the issue is caused by using latest versions of “form-data” and “request” repositories. So if you are having same issue just downgrade the above mentioned repositories to exactly: 

"form-data": "2.1.4",
"request": "2.81.0" // Most important

And do specify a filename parameter while appending file to formData like:

formData.append("file", request(bundle.inputData.file), {
    filename: bundle.inputData.name // This filename is important, if removed it will throw error
})

Regards,
Karan Singh Sisodia