APIs & Integrations

Taco
Member

Upload file with .net api does not work

I am trying to upload an file to hubspot with the .net api.

I use the following code:

byte[] btBuffer = File.ReadAllBytes(/*Correct path to file*/);

FileHubSpotModel fhm = new FileHubSpotModel {

    File = btBuffer,

    Name = "demo",

    Hidden = false,

    Overwrite = false,

    FolderPaths = "demo",

    Type = ".csv" };

_HapiApi.File.Upload<FileHubSpotModel>(fhm);

 

This throws the following error:

16:06:03] [Error] HubSpot.NET.Core.HubSpotException: Error from HubSpot, JSONResponse=Empty
at HubSpot.NET.Core.HubSpotBaseClient.ExecuteMultipart[T](String absoluteUriPath, Byte[] data, String filename, Dictionary`2 parameters, Method method)
at HubSpot.NET.Api.Files.HubSpotCosFileApi.Upload[T](FileHubSpotModel entity)

 

Do you have anny input?

0 Upvotes
2 Replies 2
dennisedson
HubSpot Product Team
HubSpot Product Team

Upload file with .net api does not work

heyo @Taco ,

I admit that I do not know much about the .net wrapper.  

Going to throw a couple of people who were in conversation in this thread a while back

 

Dear @turner_bass  and @gotmike , would you two mind looking at this question?

 

Thanks!

d

0 Upvotes
Taco
Member

Upload file with .net api does not work

Thanks for your reply, I also asked this question a week before this question in github, but the devolpment seems to have stalled. The last commit was in november 2019. I had some issues to get the latest github version working.

 

What I try to acomplish is to add documents to a deal and eddit those some document at a later time. Can you tell me if that is the right approach?

0 Upvotes