Skip to main content
Question

Sending file + other data to my custom web api

  • December 26, 2024
  • 1 reply
  • 26 views

Hi! I am trying to send information and a file to a web api that I created. I can update the web api to support this. 

Basically in zapier I did the following (see screenshot) 
This is the code to my web api. 

 [HttpPost]
        public async Task<IActionResult> Post([FromForm] IFormFile file, [FromForm] EmailData data)
        {
            Console.WriteLine(data.Subject);
            Console.WriteLine(file.FileName);
             return Ok();
        }


I can either send the subject info or the file info - it is not allowing me to send both. If I update the parameters in my web api to recieve only the file - and send only the file it works well or if I update the parameters to recieve only the EmailData (which is a class with a property of subject) and send only the subject it works well. I need both values.  Any assistance would be greatly appreciated!

Thank you! 

Did this topic help you find an answer to your question?

1 reply

  • Beginner
  • 2 replies
  • January 8, 2025

I’m afraid you won’t be able to get it since it seems webhook zap has a buggy behaviour when sending both form params and files.

Please look at this related topic

 

I’ve just asked for ETA. Until the fix is deployed the only workaround may be using a code zap step and perform the api call by yourself