Invoke-WebRequest

Description

Gets content from a web page on the Internet.

Command
Invoke-WebRequest
Examples
Get a web page
Invoke-WebRequest -Uri 'https://www.google.com'
Download a file
Invoke-WebRequest -Uri 'https://example.com/file.zip' -OutFile '.\file.zip'
Make a POST request with a JSON body
$body = @{ key = 'value' } | ConvertTo-Json; Invoke-WebRequest -Uri 'https://api.example.com/items' -Method POST -Body $body -ContentType 'application/json'
Parameters
Parameter Type Required Description
[-Uri] <Uri> string No Specifies the URI of the web resource.
[-Method <WebRequestMethod>] string No Specifies the HTTP method to use (e.g., GET, POST, PUT).
[-OutFile <String>] string No Specifies the output file to save the response body.
[-Body <Object>] string No Specifies the body of the request for POST/PUT methods.
Command Info
Category: Networking
Type: Powershell
Views: 12
Status: Active
Tags
powershell web http request curl wget iwr