Request failed with status code 415 on File manager API v3
SOLVE
Hey all!
I've been trying to uplaod a file to file manager using this endpoint
POST /filemanager/api/v3/files/upload
But idk what's wrong with my script, as I'm not reading from any file as given in example. I'm just getting the file in binary form from an Url and after buffer making it a readable stream object and passing it to the above mentioned end point
Request failed with status code 415 on File manager API v3
SOLVE
I was trying to download file from the url and then upload the binary data of that file to the Hubspot Api endpoint. But for the mentioned endpoint you can't directly upload that binary data, there must be a file in your system in which your data exists, then you directly upload that file from your system. For uploading file from the url, you have different endpoint which is "/files/v3/files/import-from-url/async"
Request failed with status code 415 on File manager API v3
SOLVE
I was trying to download file from the url and then upload the binary data of that file to the Hubspot Api endpoint. But for the mentioned endpoint you can't directly upload that binary data, there must be a file in your system in which your data exists, then you directly upload that file from your system. For uploading file from the url, you have different endpoint which is "/files/v3/files/import-from-url/async"
Hi , although your code looks fine to me , but could you please share the response what you are getting after hitting the code. also can you please try this code for uploading the file var request = require('request'); var fs = require('fs');
My code is working fine if I use file in filename and use readStream to read the file. But whenever I get the attachment from the external Url and using buffer or PassThrough stream, I send it to hubspot server I get this error
UnhandledPromiseRejectionWarning: Error: Request failed with status code 415
The HTTP 415 Unsupported Media Type client errorresponsecode indicates that the server refuses to accept the request because the payload format is in an unsupported format. The format problem might be due to the request's indicated Content-Type or Content-Encoding, or as a result of inspecting the data directly.
Hope this helps!
If we were able to answer your query, kindly help the community by marking it as a solution.
Request failed with status code 415 on File manager API v3
SOLVE
@webdew I know what 415 means, that's why I asked question here in first place. I just wanna know the exact problem in my payload which I'm sending to Hubspot file API and what kind of data hubspot is receiving from my end which is causing the actual problem.