With the code below attempting to send a zip file to the sis_imports API, I am getting a PowerShell error, "Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send."
$URL = "https://$APIDomain/api/v1/accounts/1/sis_imports"
$headers = @{"Authorization"="Bearer "+$Token}
$InFile = $ZipDestinationFull <# path to zip file #>
$contentType = "application/zip"
Invoke-WebRequest -URI $URL -Headers $headers -Method POST -InFile $InFile -ContentType $contentType
Any idea what I'm missing?
Note, the code seems to work for PowerShell 7, but not PowerShell 5 (the version that my institution uses).