Tips, Tricks & Best Practices

tme
Teilnehmer/-in

How to upload multiple files at the same time via api

We can upload file (https://legacydocs.hubspot.com/docs/methods/files/v3/upload_new_file) mentioned in the article, but if I have multiple files, I have to call the api request n number of time ( n = no. of files). I'm looking for a quick way, where I can achieve this in single api call.

4 Antworten
PamCotton
Community-Manager/-in
Community-Manager/-in

How to upload multiple files at the same time via api

Hello @tme, I was able to investigate more about it and when looking to pass multi-files you are able to use the HubSpot Form APIs, you would need to send the same field for each file, example:

 

var data ={
   "fields":[
      {
         "name":"email",
         "value":"getEmail"
      },
      {
         "name":"filemulti",
         "value":"https://file-url.jpg"
      },
      {
         "name":"filemulti",
         "value":"https://file-url2.jpg"
      ]
   }

Let me know if this works for you!

 

Kindly,

Pam

Você sabia que a Comunidade está disponível em outros idiomas?
Participe de conversas regionais, alterando suas configurações de idioma !


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !




PTewani
Mitglied

How to upload multiple files at the same time via api

That didn;t worked for me. it overwrote the previous one with the newest one.

0 Upvotes
tme
Teilnehmer/-in

How to upload multiple files at the same time via api

Hey @PamCotton, thanks for the reply

 

We want to get different files from the user like their resume, profile pic, and introductory video. Internally, Hubspot uses this API endpoint 'https://forms.hsforms.com/submissions/v3/public/submit/formsnext/multipart/:portalID/:formGuid',

where we can submit different files at the same time, and don't have to worry about uploading the files.

 

What we're trying to do is, instead of using HubSpot form, we want to use our custom form for a better user experience, and submit the form data using API (the file will be in binary format). Right now we are trying to use this API endpoint

'https://api.hsforms.com/submissions/v3/integration/submit/:portalID/:formGuid', but its content-type is application/json and we can't send a binary string (file data) to it, based on your solution we have to upload these files somewhere (like Hubspot), and then provide the URL of that file, which is working. But we want to implement it as you do it using your internal API endpoint. is it possible? do you have any public API endpoint like it? if No, is this is the only way to do it (first upload files on Hubspot using file upload API and submit the form by providing that URL)?

 

 

PTewani
Mitglied

How to upload multiple files at the same time via api

Facing the same issue, Can hubspot team look in to this ? Many peoples are facing this issue

0 Upvotes