to get a personalized navigation.
to get a personalized navigation.
Please see attachment specific endpoints at https://integration.visma.net/API-index/
Webclient Class
public void postAttachment(string[] files, string <objectID>, string token, string companyId) { using (WebClient client = new WebClient()) { client.Headers.Add("ipp-company-id", "<companyId>"); client.Headers.Add("ipp-application-type", "Visma.net Financials"); client.Headers.Add("Authorization", "bearer<token>"); for (int i = 0; i < files.Length; i++) // Multiple { byte[] responseArray = client.UploadFile(@"https://integration.visma.net/API/controller/api/v1/<Endpoint>/"+<objectID>+"/Attachment", "POST", files[i]); } } }
HttpClient Class
public void postAttachmentHttpClient() { using (var client = new HttpClient()) { client.DefaultRequestHeaders.Add("ipp-application-type", "Visma.net Financials"); client.DefaultRequestHeaders.Add("ipp-company-id", "<companyID>"); client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>"); HttpResponseMessage response; var content = new MultipartFormDataContent(); var path = Path.Combine(@"<path>"); string fileName = Path.GetFileName(path); FileStream fs = File.OpenRead(path); var sc = new StreamContent(fs); sc.Headers.Add("Content-Type", "application/octet-stream"); sc.Headers.Add("Content-Disposition","form-data; name=\"file\"; filename=\"" + Path.GetFileName(path) + "\""); content.Add(sc, "file", fileName); response = client.PostAsync(@"https://integration.visma.net/API/controller/api/v1/<endpoint>/<objectID>/Attachment", content).Result; } }
Disclaimer
The sample code on Visma Community > Visma.Net API is provided “AS IS” and any express or implied warranties, including the implied warranties of merchantability and fitness for a particular purpose, are disclaimed. In no event shall Visma or contributors be liable for any direct, indirect, incidental, special, exemplary or consequential damages.
Copyright © 2022 Visma.com. All rights reserved.