Hi. I’m having difficulty with uploading files using the API. I keep getting an error 400 “Bad Request”, which doesn’t give any more info about what’s wrong.
I’ve read the documentation here:
https://developers.hubspot.com/docs/methods/files/post_files
And I’ve read various forum posts like this one:
https://community.hubspot.com/t5/APIs-Integrations/Rest-API-for-File-upload/td-p/280715
The trouble is that these all explain how to do it with particular languages, such as Python. I’m using VBA, and what I really need to see is a sample of an actual HTTP request. Here’s the HTTP request I’m trying…
POST https://api.hubapi.com/filemanager/api/v2/files?hapikey=[redacted]
User-Agent: VBA-Web v4.1.3 (https://github.com/VBA-tools/VBA-Web)
Content-Type: multipart/form-data; boundary=qixbgmtyosycfhj-----------------------------9674769684763
Accept: application/json
Content-Length: 363
--qixbgmtyosycfhj-----------------------------9674769684763
Content-Disposition: form-data; name="files"
VGhlIHF1aWNrIGJyb3duIGZveA0KDQpqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw0KDQo=
--qixbgmtyosycfhj-----------------------------9674769684763
Content-Disposition: form-data; name="file_names"
abc.txt
--qixbgmtyosycfhj-----------------------------9674769684763
I’ve tried many other permutations too.
By the way, it’s not clear whether the file contents need to be encoded in any way. Should non-text files be encoded as Hex64?