for some reason I got stuck with an simple Invoke-WebRequest
. I need to send an XML-File to a website by Method "POST" and enc-Type "multipart/form-data". My code:
$SupraliftXML="C:\supralift.xml"
$Uri = 'https://www.supralift.com/servlet/EcutServlet?handler=BulkloadHandler&jfaction=0'
$Form = @{
muddledPassword = 'mypassword'
userID = 'myuserID'
XMLfile = Get-Item -Path $SupraliftXML
}
$Result = Invoke-RestMethod -AllowUnencryptedAuthentication -Uri $Uri -Method Post -Form $Form
I got an error that there is no parameter like "-form"
$Result = Invoke-WebRequest -Uri $Uri -Method Post -Form $Form + CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Thank you for any help!