Uploading an image attachment to a request with powershell

Uploading an image attachment to a request with powershell

Hello,

I am unable to attach an image to a request using a powershell script and the API.  This works just fine in BASH.  I can use the following bash script with no issue:

curl -X PUT \
    -H "authtoken: ABC123" \
    -F "document=@/filepath/" \
   

But when I made this same request using powershell, I receive an internal error.  This is my script below:

$headers = @{
    "authtoken" = "ABC123"
}

$file = "C:\filepath"
$url = "https://url/api/v3/requests/124564/upload"

$result = Invoke-RestMethod -Method Put -Uri $url -Headers $headers -InFile $file

Does anyone know what I might be doing wrong here?  This is the error I'm getting:
{"response_status":{"status_code":4000,"messages":[{"status_code":4004,"type":"failed","message":"Internal error"}],"status":"failed"}}



                  New to ADSelfService Plus?