Author Posts

May 17, 2018 at 10:48 am

I am trying to upload an excel file, while trying the same from postman it is working fine but while trying it from power shell it is not working.

Here are the below details I am using on postman
Methode : POST
URL : https://localhost/api/v1/boarding/validate
In the header section
authorization: 09368290_0d9227327d291d8a
body section "
Type : form-data:
filename: "C:\\Users\\Desktop\\Template.xlsx"
Content-Type :application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Disposition : form-data

any thoughts on this ?

May 17, 2018 at 2:54 pm

Can you post the PowerShell code you are trying to use?

May 18, 2018 at 12:25 pm

$validationBody = (
'Content-Disposition: form-data','name = file',`
'Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
Invoke-RestMethod -Method Post `
-Uri $ValidatorAPI `
-Headers @{"Authorization" = $ResNew ; "accept" = "application/json"} `
-ContentType "multipart/form-data" `
-Body $validationBody

May 18, 2018 at 12:53 pm

While sending the same thing on postman it is working fine