Skip to main content
Question

Issue with getting and posting files via Webhook

  • 5 June 2024
  • 4 replies
  • 62 views

Hello Zapier community

I am new to Zapier and I love it.

This is my first post so sorry if I am doing anything wrong - any feedback is appreciated!

I am trying to make a demo in which I create a page in Contentful (using a POST request in a webhook) starting from elements in a Zapier Table.

 

I have a problem with a Zap, where I use

  • A GET webhook to get a file from a URL 
  • a POST webhook to send the file to Contentful’s upload api

The GET request is using the url of the picture (an online picture accessible and downloadable in the public internet) and in it i have

  • send as json: Np
  • json key: json
  • Unflatten: Yes (I don’t think this is relevant)
  • All the rest is empty
  • The call works and returns a file (hydrate|||.eJw9jstu etc)

I think my POST webhook is correctly formed, I checked it a million times.

I use 

  • the right upload url
  • the right authentication header
  • Data : empty
  • payload type = raw
  • file (exists but not shown) taken from the previous GET request
  • Unflatten: Yes (i don’t think this is relevant in any way)

The problem is that, even if in my header I have “Content Type” set as “application/octet-stream”, I keep getting an error of “The "Content-Type" header must be "application/octet-stream" (HTTP Status Code: 400)

I spent at least a dozen hours on this, trying to figure it out but I failed miserably.

 

Any help or suggestion will be welcome! 

4 replies

Userlevel 7
Badge +14

Hi @MircoF 

For us to have more context, post screenshots with how your Zap steps are outlined and configured in EDIT mode along with the data that you are trying to use as it is returned from each step.

Also, link to the API endpoint documentation you referenced to configure your API request.

Hello Mr @Troy Tessalone 

I had posted an answer, but I suppose it is stil under review??

 

Anyhow, i try to reupload the screenshots, and here is the link to the contentful CM Api: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/uploads/upload-a-file

 

I tried all possible variants and versions, but the call always gets the answer “ “The "Content-Type" header must be "application/octet-stream" (HTTP Status Code: 400)””

Of course with the content type set exactly as this one.

Thank you for letting me know, if you can spend one moment of your precious time helping us with this.

 

Have a wonderful day! 

 

 

Userlevel 7
Badge +14

@MircoF 

Try changing the Payload Type = Form

 

Hello and thank you for the reply!

I tried with form, and i tried many more combinations (for example adding the file in the data field, as I thought this might have matched the syntax for the API call from Contentful).

None of my attempts worked sadly, and in the end I decided to not include the images in my demo - but of course I am still very interested in this, because it could be a game changer for my company.

Anyhow if you have any other precious suggestion I will be gladly trying! thanks!

Reply