September 17, 2015
You go along way by calling apis at the command line. Powershell provides the following methods that you will find useful...
Examples of simple api web request
# Get a page over httpInvoke-RestMethod -URI https://www.google.com -Method "GET"# Post text content over httpInvoke-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').ProxyServerInvoke-RestMethod -URI https://www.google.com -Method "GET" -Proxy $Webproxy -UseDefaultCredentials
Examples using the IE Browser Proxey settings
back# Read out proxy settings$Webproxy = (get-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').ProxyServer# Wrapper method for Invokeing a rest methodfunction Invoke-Request {Param( [string]$Method="GET", [string]$Body, [string]$Url )if($Method -eq "GET") {return Invoke-RestMethod -Proxy $Webproxy -UseDefaultCredentials -URI $Url -Method "GET"} else {return Invoke-RestMethod -Proxy $Webproxy -UseDefaultCredentials -URI $Url -ContentType "application/json" -Method $Method -Body $Body}}#Example Usage GetInvoke-Rest -Url "https://octopus2/api//Teams?apiKey=$API_KEY"