Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions reference/5.1/Microsoft.PowerShell.Utility/Invoke-RestMethod.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Utility
ms.date: 02/05/2025
ms.date: 10/29/2025
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
aliases:
Expand Down Expand Up @@ -37,16 +37,12 @@ the Item or Entry XML nodes. For JavaScript Object Notation (JSON) or XML, Power
deserializes, the content into `[pscustomobject]` objects. Comments aren't permitted in the JSON
data.

> [!NOTE]
> When the REST endpoint returns multiple objects, the objects are received as an array. If you pipe
> the output from `Invoke-RestMethod` to another command, it is sent as a single `[Object[]]`
> object. The contents of that array are not enumerated for the next command on the pipeline.
> [!WARNING]
> By default, `Invoke-RestMethod` parses the content of the web page. Script code in the web page
> might be run when the page is parsed. Use the `-UseBasicParsing` switch to avoid script code
> execution.
This cmdlet is introduced in Windows PowerShell 3.0.

> [!NOTE]
> By default, script code in the web page may be run when the page is being parsed to populate the
> `ParsedHtml` property. Use the **UseBasicParsing** switch to suppress this.
This cmdlet is introduced in Windows PowerShell 3.0. This command can be run using the `irm` alias.

## EXAMPLES

Expand Down Expand Up @@ -737,6 +733,10 @@ Windows PowerShell includes the following aliases for `Invoke-RestMethod`:

- `irm`

When the REST endpoint returns multiple objects, the objects are received as an array. If you pipe
the output from `Invoke-RestMethod` to another command, it's sent as a single `[Object[]]` object.
The contents of that array aren't enumerated for the next command on the pipeline.

## RELATED LINKS

[ConvertTo-Json](ConvertTo-Json.md)
Expand Down
25 changes: 12 additions & 13 deletions reference/5.1/Microsoft.PowerShell.Utility/Invoke-WebRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Utility
ms.date: 01/25/2024
ms.date: 10/29/2025
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
aliases:
Expand Down Expand Up @@ -37,15 +37,12 @@ significant HTML elements.

This cmdlet was introduced in Windows PowerShell 3.0.

> [!NOTE]
> By default, script code in the web page may be run when the page is being parsed to populate the
> `ParsedHtml` property. Use the `-UseBasicParsing` switch to suppress this.
> [!WARNING]
> By default, `Invoke-WebRequest` parses the content of the web page. Script code in the web page
> might be run when the page is parsed. Use the `-UseBasicParsing` switch to avoid script code
> execution.
> [!IMPORTANT]
> The examples in this article reference hosts in the `contoso.com` domain. This is a fictitious
> domain used by Microsoft for examples. The examples are designed to show how to use the cmdlets.
> However, since the `contoso.com` sites don't exist, the examples don't work. Adapt the examples
> to hosts in your environment.
This command can be run using the `iwr`, `curl`, or `wget` aliases.

## EXAMPLES

Expand Down Expand Up @@ -155,7 +152,7 @@ $StatusCode
The terminating error is caught by the `catch` block, which retrieves the **StatusCode** from the
**Exception** object.

### Example 8: Download multiple files at the same time
### Example 5: Download multiple files at the same time

The `Invoke-WebRequest` cmdlet can only download one file at a time. The following example uses
`Start-ThreadJob` to create multiple thread jobs to download multiple files at the same time.
Expand Down Expand Up @@ -221,13 +218,13 @@ request content to the form fields.
For example:

`$r = Invoke-WebRequest https://website.com/login.aspx`
`$r.Forms\[0\].Name = "MyName"`
`$r.Forms\[0\].Password = "MyPassword"`
`$r.Forms[0].Name = "MyName"`
`$r.Forms[0].Password = "MyPassword"`
`Invoke-RestMethod https://website.com/service.aspx -Body $r`

- or -

`Invoke-RestMethod https://website.com/service.aspx -Body $r.Forms\[0\]`
`Invoke-RestMethod https://website.com/service.aspx -Body $r.Forms[0]`

```yaml
Type: System.Object
Expand Down Expand Up @@ -761,6 +758,8 @@ This cmdlet returns the response object representing the result of the web reque
Windows PowerShell includes the following aliases for `Invoke-WebRequest`:

- `iwr`
- `curl`
- `wget`

## RELATED LINKS

Expand Down