Skip to content

Instantly share code, notes, and snippets.

@johnmmoss
Created September 17, 2015 10:08
Show Gist options
  • Save johnmmoss/4bce614744d80ef18183 to your computer and use it in GitHub Desktop.
Save johnmmoss/4bce614744d80ef18183 to your computer and use it in GitHub Desktop.
Examples using Invoke-RestMethod
# Get a page over http
Invoke-RestMethod -URI https://www.google.com -Method "GET"
# Post text content over http
Invoke-RestMethod -URI http://mvcsampleapp.apphb.com/Feedback -Body "Email=afsd&FirstName=sdfasdf&Surname=fasdfsd&Text=fasdfsdafsd" -ContentType "text/html" -Method POST
# Get a page over http specifying the IE proxey server
$Webproxy = (get-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').ProxyServer
Invoke-RestMethod -URI https://www.google.com -Method "GET" -Proxy $Webproxy -UseDefaultCredentials
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment