Invoke-WebRequest -Method POST

Welcome Forums General PowerShell Q&A Invoke-WebRequest -Method POST

Viewing 1 reply thread
  • Author
    • #225468
      Topics: 4
      Replies: 6
      Points: 59
      Rank: Member


      I have a project to run a cmdlet whether on a server or workstation to get the list of updates which includes the description of the update, date/time installed, so I went ahead and used Get-WUHistory and it did showed me the results I wanted.

      Here’s my issue, my boss wanted me to send/export the results instead of saving it to a file, he wants me to send the results to one of our websites. I used the cmdlet

      Invoke-WebRequest -Uri https://<domain&gt; -Method POST

      But I talked to one of the developer of the website and told me to include the ff:

      token: xxxxxxxxxx

      private_ip: 192.x.x.x

      I run the following cmdlet below:


      Invoke-WebRequest -Uri https://<domain&gt; -Method POST

      And I’m getting a Bad Request (400) error so I’m not sure if I’m doing the proper way in doing POST



      • This topic was modified 4 months, 2 weeks ago by TECH-JEFF65.
      • This topic was modified 4 months, 2 weeks ago by TECH-JEFF65.
    • #225546
      Topics: 0
      Replies: 37
      Points: 371
      Helping Hand
      Rank: Contributor

      Hello Jeff,

      Looks like you need to get more information from your API developer and use tools like Postman or any addons for your browser to debug/test your API requests. For example Resting for Mozilla:

      From your post it appears that you need to provide auth token to your API(in headers or in query) and POST your Get-WUHistory output int the request body.

      Hope that helps.


Viewing 1 reply thread
  • The topic ‘Invoke-WebRequest -Method POST’ is closed to new replies.