CMS Files API on PHP - Upload a new file - Error 400 Bad Request
SOLVE
Hi, I'm currently integrating CMS Files API to my project to be able to upload files from my project to the HubSpot File Manager. I followed and used the sample PHP script on https://legacydocs.hubspot.com/docs/methods/files/v3/upload_new_file but I kept getting Error 400 - Bad Request response from the server. I'm using Oauth2.0 for authentication.
I tested other endpoints like Delete a File, Create a Folder and it works properly. Upload a file is the only endpoint that returns Error 400. Any help would be appreciated.
Can you provide us the request and the answer in the call-log of your api key ? You can get it in settings > integrations > apikey. It will help us to understand what is going wrong.
I have checked the call logs from the two HubSpot accounts that I'm using for the development of the integration. Unfortunately, there are no API logs under the file upload endpoint. Not sure if it's because I'm using Oauth2.0 for the authentication.
CMS Files API on PHP - Upload a new file - Error 400 Bad Request
SOLVE
Hi @dennisedson, can you confirm if you run the code on an HTTPS environment? Because I've been testing the same PHP code from the example on localhost and kept getting error 400.