Invoke-RestMethod sends HTTP or HTTPS requests and converts response content into PowerShell objects. Save the result to a variable, then process it like any other object instead of parsing raw output or creating custom classes. section 9.3
A request normally combines a URI, method, body, and headers. The URI identifies the resource and may carry parameters; the method describes the operation, the body commonly carries POST or PUT data, and headers provide authentication or content-type information. JSON and XML have native PowerShell support. section 9.3
Retrieve an external IP address
$IP = Invoke-RestMethod -Uri 'https://api.ipify.org?format=json' $IP.ip section 9.3
Use API documentation to determine the service’s URI patterns, methods, headers, authentication, and response conventions. REST is an architectural style rather than a protocol or standard, so implementations can define their own patterns. section 9.3
For broader system-report automation, retrieve external IP information with ipify, combine it with internal network data and performance counters, and write the collected objects into a Word report. section 9.5
$IP = Invoke-RestMethod -Uri 'https:/ /api.ipify.org?format=json' $IP ip -- 48.52.216.180
A minimal request-and-property-access example shows how JSON returned by an API becomes a directly usable PowerShell object. section 9.3
