APIs & Integrations

Vidar
Participante | Parceiro
Participante | Parceiro

C# Download files via the api

resolver

Hi!

 

I'm looking around here in the community but can't seem to find a clear answer.

I want to be able to get the base64 of a file from Hubspot.

 

On a deal, I've added two attachments. 

Vidar_0-1617806835762.png

I'm retrieving both via the API and it works fine. Although it's strange how to retrieve them as well.

 

I get the URL of these and want to use that URL to get the base64 of those attachments. Is there a way to do this?

 

When I'm testing this via the browser I get a 404

Vidar_1-1617807047573.png

 

Do I need to use the cloud_key_hash someway or is there another endpoint for this?

 

Best Regards,

Vidar

 

 

0 Avaliação positiva
1 Solução aceita
MichaelC
Solução
Orientador(a) | Parceiro
Orientador(a) | Parceiro

C# Download files via the api

resolver

@Vidar Sorry I have not streamed any files from hubspot before - only through other apis. 

 

@dennisedson can you reach out to the developers and ask if the URL gotten through the interface "GET /files/v3/files/{fileId}/signed-url" needs to be streamed though the code and if the stream of that generated URL require specific http headers. I know the file is only valid for a few seconds so I see no other way to do this than to stream from the generated URL. If you have any C# developer that can help its a plus but not a requirement - the question is really http related.



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

Exibir solução no post original

8 Respostas 8
Vidar
Participante | Parceiro
Participante | Parceiro

C# Download files via the api

resolver

Thanks! I think it was the /signed-url endpoint I was looking for. 🙂 

0 Avaliação positiva
MichaelC
Orientador(a) | Parceiro
Orientador(a) | Parceiro

C# Download files via the api

resolver

Hi,

 

By just pasting the link into you browser you wont be able to have the correct headers in the http connection so it wont work for that reason. 

 

You need to get the file through your code by streaming the file or downloading the file using your code and to put it into a directory on your server from there. 

 

I dont know C# to help you in the actual code - but within PHP the way to stream it and add it to the server is the way it works.

 

Kind regards,

Michael



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

Vidar
Participante | Parceiro
Participante | Parceiro

C# Download files via the api

resolver

@MichaelC  Do you know which headers I need to use for it to be able to get access?

0 Avaliação positiva
MichaelC
Solução
Orientador(a) | Parceiro
Orientador(a) | Parceiro

C# Download files via the api

resolver

@Vidar Sorry I have not streamed any files from hubspot before - only through other apis. 

 

@dennisedson can you reach out to the developers and ask if the URL gotten through the interface "GET /files/v3/files/{fileId}/signed-url" needs to be streamed though the code and if the stream of that generated URL require specific http headers. I know the file is only valid for a few seconds so I see no other way to do this than to stream from the generated URL. If you have any C# developer that can help its a plus but not a requirement - the question is really http related.



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

gotmike
Top colaborador(a)

C# Download files via the api

resolver

sure thing. what do you mean by this?


@Vidar wrote:

 

I'm retrieving both via the API and it works fine. Although it's strange how to retrieve them as well.

Vidar
Participante | Parceiro
Participante | Parceiro

C# Download files via the api

resolver

@gotmike Oh sorry, it relates to the image, I fetch both attachments on the deal. 

The reason I find it strange is that I cant just fetch attachments on a deal from what I found.

I need to do this:

Vidar_0-1617891425789.png

First crm-associations then engagements then files. But maybe this is very wrong?

0 Avaliação positiva
dennisedson
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

C# Download files via the api

resolver

Hey @Vidar 

Going to throw a few people at this for you 😀

@gotmike , @MichaelC , @JeanAMOROS  could any of you lend a hand here?

Vidar
Participante | Parceiro
Participante | Parceiro

C# Download files via the api

resolver

Thanks 🙂 

0 Avaliação positiva