0

Invoke-WebRequest returns an invalid operation error

>powershell Invoke-WebRequest -Uri https://webhook.site/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -Method POST -InFile HappyMeal

above command returned below error

Invoke-WebRequest : The remote server returned an error: (500) Internal Server Error.
At line:1 char:1
+ Invoke-WebRequest -Uri https://webhook.site/xxxxxxxx-xxxx-xxxx-xxxx...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

how do i fix this?

lenzfliker
  • 35
  • 1
  • 7
  • 1
    Do you have the code on the server side? This error indicates there is something wrong there. You could als call this API the wrong way. – Jeroen Heier Sep 21 '19 at 11:30
  • @JeroenHeier code is on a digispark (rubberducky). It POSTs a file to https://webhook.site – lenzfliker Sep 21 '19 at 11:36
  • There's not enough information in your question to diagnose the problem. Please add additional information, ideally in the form of an [MCVE (Minimal, Complete, and Verifiable Example)](http://stackoverflow.com/help/mcve) or as close as you can get to one. – mklement0 Sep 22 '19 at 08:06

0 Answers0