As I’m writing a POST method to send excel files from my API to PipeDrive API I encountered a convertion problem(or the lack of convertion).
The file comes coded (it is being send as a binary file as said in docs Pipedrive API v1 Reference) into PipeDrive API.
After the file reaches PipeDrive, the file is unreadable. As can be seen upon downloading from PipeDrive.
However If I manualy decode the file it is readable(which proof sit comes uncorrupted to PipeDrive).
Here is an example of the C# code that shows how it is being coded and sent to PipeDriveApi:
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, EndpointURL);
var body = new MultipartFormDataContent();
Console.WriteLine(“File does not exist:” + filePath”);
return res; }
Byte bytes = System.IO.File.ReadAllBytes(filePath);
String file = Convert.ToBase64String(bytes);
body.Add(new StringContent(file), “file”, Path.GetFileName(filePath));
body.Add(new StringContent(dealId.ToString()), “deal_id”);
request.Content = body;
var response = client.SendAsync(request).Result;
Does anyone know how to send files and code it soi t comes properly to PipeDrive?
Any help appreciated!