Thanks for your reply. Yup, please do update them in this post as it will be useful for me or anyone else who will be needing it in the future.
As an alternative after hard trial and error as well as some help from @Vishal_K’s post, i finally found a solution to upload XLSX into the system via API.
Please follow exactly the pre-requisites that needed for this as per this post Unable to Http Request POST API With Attachment . Based on the code that @Vishal_K provided i’ve made a minor modification by including the content-type into the attachment. Please see below for the code:
Dim client As HttpClient = New HttpClient()
client.BaseAddress = New Uri(“https://api.example.com”)
client.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue(“Basic”, “<hash code>”)
Dim request As MultipartFormDataContent = New MultipartFormDataContent()
Dim sc As StreamContent = New StreamContent(File.OpenRead(“C:\UiPath\Development\data\example.xlsx”))
sc.Headers.ContentType = New MediaTypeHeaderValue(“application/vnd.openxmlformats-officedocument.spreadsheetml.sheet”)
Dim response As HttpResponseMessage = client.PostAsync("", request).Result
If response.IsSuccessStatusCode Then
Dim responseContent As HttpContent = response.Content
Dim responseString As String = responseContent.ReadAsStringAsync.Result
Console.WriteLine("failed: " + response.Content.ReadAsStringAsync.Result)