How to create signed url redirect for uploaded private image?
I am trying to make custom form with image upload. The form sends data to my backend endpoint. The endpoint uses `/filemanager/api/v3/files/upload` to upload the images first to HubSpot. Also I want the images to be private. Then I would like to submit result with `https://api.hsforms.com/submissions/v3/integration/submit/:portalId/:formGuid`.
But the problem is that when adding image urls which I got back from `/filemanager/api/v3/files/upload` to form submit endpoint the url cannot be opened because they are private.
So my main question is how can I get sign, conversionId, and filename? The documentation does not mention anything about these 3 properties. Can you help me?
How to create signed url redirect for uploaded private image?
@henrikra - I see, thank you for the clarification.
When submitting files through the form api, you just need to include a fully qualified url to the source (including domain name). So your frontend form would save the file to your server (or something like amazon s3) then in the forms API you would pass that file field with the value of that URL. Although the form is using file upload, the api only expects a string which represents the location of the image.
So, in your last step where you submit the form you would add the url to the fields props
It looks like in step 4 you might be trying to use the hubspot file manager as the storage device. I don't remember if that API endpoint returns the full location of the file URL but I think that's what you need to pass in the "value" field.
How to create signed url redirect for uploaded private image?
@tjoyce I'm running into the exact same problem. I can upload private files just fine, but I cannot figure out how to successfully send final urls (multiple urls, in some cases) to the form. Thank you!
How to create signed url redirect for uploaded private image?
Yeah I noticed the same that it is enough just to give string url to the form api to file fields. That is not the issue.
And yes you are correct I would like to use hubspot file api to upload file since it does exactly what I want + I want the files to be private, not public.
But I noticed that if I open form submission from hubspot console and see what values the fields got the file field has clickable link only if Hubspot file api was used. And I would like to that clickable link always work even with private files. And that brings to my original question: how can I create signed url for the private image that was uploaded to Hubspot api. Signed-url creates me link in which I can access the private image right? But seems like there is no way to create that signed url by yourself 😕
How to create signed url redirect for uploaded private image?
@henrikra - All you have to do is fetch the contact from the api that you're trying to retrieve a file for. Then look at the property you used for the file upload... The initial request of the contact property will give you the complete and exact URL you need to pass... you don't have to build this URL.
I think it will be clear to you if you navigate to a contact that has submitted the form with a file. If you look at that contact's properties, and head to the file upload property, you will see the complete signed URL there. So basically you need to just fetch this contact property from the API and pass that as the signed URL.
So can you tell me where I am doing it wrong? Which Hubspot APIs (and in which order) should I call when I have custom form UI with file upload and I want to submit form data to Hubspot.