Skip to content

restoring changes made in PR#1870 #2089

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 1, 2018
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
25 changes: 12 additions & 13 deletions reference/6/Microsoft.PowerShell.Utility/Invoke-RestMethod.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
ms.date: 2017-06-09
ms.date: 2017-11-17
schema: 2.0.0
locale: en-us
keywords: powershell,cmdlet
Expand Down Expand Up @@ -115,12 +115,12 @@ $Body = @{
earliest_time = "-2d@d"
latest_time = "-1d@d"
}
Invoke-RestMethod -Method 'Post' -Uri $url -Credential $Cred -Body $body -SkipCertificateCheck -OutFile output.csv
Invoke-RestMethod -Method 'Post' -Uri $url -Credential $Cred -Body $body -SkipCertificateCheck -OutFile output.csv
```

In the above example, a user runs `Invoke-RestMethod` to perform a POST request on an intranet website in the user's organization.
In the above example, a user runs `Invoke-RestMethod` to perform a POST request on an intranet website in the user's organization.

First, credentials are prompted for and then stored in `$Cred` and the URL that will be access is defined in `$Url`.
First, credentials are prompted for and then stored in `$Cred` and the URL that will be access is defined in `$Url`.

Next, The `$Body` variable describes the search criteria, specifies CSV as the output mode, and specifies a time period for returned data that starts two days ago and ends one day ago. The body variable specifies values for parameters that apply to the particular REST API with which `Invoke-RestMethod` is communicating.

Expand Down Expand Up @@ -165,12 +165,12 @@ Available Authentication Options:
- **OAuth**: Requires **-Token**. Will send and RFC 6750 `Authorization: Bearer` header with the supplied token. This is an alias for **Bearer**

Supplying **-Authentication** will override any `Authorization` headers supplied to **-Headers** or included in **-WebSession**.


```yaml
Type: WebAuthenticationType
Parameter Sets: (All)
Aliases:
Aliases:
Accepted values: None, Basic, Bearer, OAuth

Required: False
Expand Down Expand Up @@ -577,7 +577,7 @@ Accept wildcard characters: False
```

### -ResponseHeadersVariable
Creates a Response Headers Dictionary and saves it in the value of the specified variable. The the keys of the dictionary will contain the field names of the Response Header returned by the web server and the values will be the respective field values.
Creates a Response Headers Dictionary and saves it in the value of the specified variable. The the keys of the dictionary will contain the field names of the Response Header returned by the web server and the values will be the respective field values.


```yaml
Expand Down Expand Up @@ -624,7 +624,7 @@ Accept wildcard characters: False

```
### -SkipCertificateCheck
Skips certificate validation checks. This includes all validations such as expiration, revocation, trusted root authority, etc.
Skips certificate validation checks. This includes all validations such as expiration, revocation, trusted root authority, etc.

> **Warning**: Using this parameter is not secure and is not recommended. This switch is only intended to be used against known hosts using a self-signed certificate for testing purposes. Use at your own risk.

Expand Down Expand Up @@ -670,7 +670,7 @@ Sets the SSL/TLS protocols that are permissible for the web request. By default
```yaml
Type: WebSslProtocol
Parameter Sets: (All)
Aliases:
Aliases:
Accepted values: Default, Tls, Tls11, Tls12

Required: False
Expand Down Expand Up @@ -701,7 +701,7 @@ Accept wildcard characters: False
```

### -Token
The OAuth or Bearer token to include in the request. **-Token** is required by certain **-Authentication** options. It cannot be used independently.
The OAuth or Bearer token to include in the request. **-Token** is required by certain **-Authentication** options. It cannot be used independently.

**-Token** takes a `SecureString` containing the token. To supply the token manually use the following:

Expand All @@ -712,7 +712,7 @@ Invoke-RestMethod -Uri $uri -Authentication OAuth -Token (Read-Host -AsSecureStr
```yaml
Type: SecureString
Parameter Sets: (All)
Aliases:
Aliases:

Required: False
Position: Named
Expand Down Expand Up @@ -874,5 +874,4 @@ Some features may not be available on all platforms.

[ConvertFrom-Json](ConvertFrom-Json.md)

[Invoke-WebRequest](Invoke-WebRequest.md)

[Invoke-WebRequest](Invoke-WebRequest.md)
Loading