< Back
Invoke-PSAuthRestMethod
Post
NAME Invoke-PSAuthRestMethod
SYNOPSIS
Execute Invoke-RestMethod including an OAuth 1.0 authorization header.
SYNTAX
Invoke-PSAuthRestMethod [-Uri] <System.Uri> [[-ContentType] <System.String>] [[-Body] <System.String>] [[-Proxy]
<System.String>] [[-OutFile] <System.String>] [[-ProxyCredential] <System.Management.Automation.PSCredential>]
[-OauthConsumerKey] <System.String> [-OauthConsumerSecret] <System.Security.SecureString> [[-OauthAccessToken]
<System.String>] [[-OauthAccessTokenSecret] <System.Security.SecureString>] [[-OauthSignatureMethod]
<System.String>] [[-OauthVersion] <System.String>] [[-OauthParameters] <System.Collections.Hashtable>] [[-Method]
<System.String>] [-DisableKeepAlive] [-Headers <System.Collections.IDictionary>] [-ProxyUseDefaultCredentials]
[<CommonParameters>]
DESCRIPTION
Executes Invoke-RestMethod but includes an OAuth 1.0 Authentication signature.
PARAMETERS
-Body <System.String>
Specifies the body of the request.
Required? false
Position? 11
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ContentType <System.String>
Specifies the content type of the web request.
If this parameter is omitted and the request method is POST, Invoke-PSAuthRestMethod sets the content type to
application/x-www-form-urlencoded. Otherwise, the content type is not specified in the call.
Required? false
Position? 10
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-DisableKeepAlive <System.Management.Automation.SwitchParameter>
Indicates that the cmdlet sets the KeepAlive value in the HTTP header to False. By default, KeepAlive is True.
KeepAlive establishes a persistent connection to the server to facilitate subsequent requests.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Headers <System.Collections.IDictionary>
Specifies the headers of the web request. Enter a hash table or dictionary.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-OutFile <System.String>
Saves the response body in the specified output file. Enter a path and file name. If you omit the path, the
default is the current location.
Required? false
Position? 13
Default value Get
Accept pipeline input? False
Accept wildcard characters? false
-Method <System.String>
Specifies the method used for the web request.
Required? false
Position? 9
Default value Get
Accept pipeline input? False
Accept wildcard characters? false
-OauthAccessToken <System.String>
The OAuth access token to use for the signature.
Required? false
Position? 4
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-OauthAccessTokenSecret <System.Security.SecureString>
The OAuth access token secret to use for the signature.
Required? false
Position? 5
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-OauthConsumerKey <System.String>
The OAuth consumer key to use for the signature.
Required? true
Position? 2
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-OauthConsumerSecret <System.Security.SecureString>
The OAuth consumer secret to use for the signature.
Required? true
Position? 3
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-OauthParameters <System.Collections.Hashtable>
Any additional parameters to include in the OAuth signature.
Required? false
Position? 8
Default value @{}
Accept pipeline input? False
Accept wildcard characters? false
-OauthSignatureMethod <System.String>
The OAuth signature hash method to use.
Required? false
Position? 6
Default value HMAC-SHA1
Accept pipeline input? False
Accept wildcard characters? false
-OauthVersion <System.String>
The OAuth signature version to use.
Required? false
Position? 7
Default value 1.0
Accept pipeline input? False
Accept wildcard characters? false
-Proxy <System.String>
Specifies that the cmdlet uses a proxy server for the request, rather than connecting directly to the Internet
resource. Enter the URI of a network proxy server.
Required? false
Position? 12
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ProxyCredential <System.Management.Automation.PSCredential>
Specifies a user account that has permission to use the proxy server that is specified by the Proxy parameter.
The default is the current user.
Type a user name, such as "User01" or "Domain01\\User01", or enter a PSCredential object, such as one generated
by the Get-Credential cmdlet.
This parameter is valid only when the Proxy parameter is also used in the command. You cannot use the
ProxyCredential and ProxyUseDefaultCredentials parameters in the same command.
Required? false
Position? 13
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ProxyUseDefaultCredentials <System.Management.Automation.SwitchParameter>
Indicates that the cmdlet uses the credentials of the current user to access the proxy server that is
specified by the Proxy parameter.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Uri <System.Uri>
Specifies the Uniform Resource Identifier (URI) of the Internet resource to which the web request is sent.
Required? true
Position? 1
Default value None
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
System.String
NOTES
-------------------------- Example 1 --------------------------
PS C:\\> Invoke-PSAuthRestMethod -Uri 'https://contoso.com/oauth2/api/get' `
-OauthConsumerKey 'MyConsumerKey' `
-OauthConsumerSecret (ConvertTo-SecureString -String 'MySecret' -AsPlainTextForce) `
-Method 'Get'
Execute Invoke-RestMethod adding an Authorization header containing an OAuth 1.0 signature.
RELATED LINKS
SYNOPSIS
Execute Invoke-RestMethod including an OAuth 1.0 authorization header.
SYNTAX
Invoke-PSAuthRestMethod [-Uri] <System.Uri> [[-ContentType] <System.String>] [[-Body] <System.String>] [[-Proxy]
<System.String>] [[-OutFile] <System.String>] [[-ProxyCredential] <System.Management.Automation.PSCredential>]
[-OauthConsumerKey] <System.String> [-OauthConsumerSecret] <System.Security.SecureString> [[-OauthAccessToken]
<System.String>] [[-OauthAccessTokenSecret] <System.Security.SecureString>] [[-OauthSignatureMethod]
<System.String>] [[-OauthVersion] <System.String>] [[-OauthParameters] <System.Collections.Hashtable>] [[-Method]
<System.String>] [-DisableKeepAlive] [-Headers <System.Collections.IDictionary>] [-ProxyUseDefaultCredentials]
[<CommonParameters>]
DESCRIPTION
Executes Invoke-RestMethod but includes an OAuth 1.0 Authentication signature.
PARAMETERS
-Body <System.String>
Specifies the body of the request.
Required? false
Position? 11
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ContentType <System.String>
Specifies the content type of the web request.
If this parameter is omitted and the request method is POST, Invoke-PSAuthRestMethod sets the content type to
application/x-www-form-urlencoded. Otherwise, the content type is not specified in the call.
Required? false
Position? 10
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-DisableKeepAlive <System.Management.Automation.SwitchParameter>
Indicates that the cmdlet sets the KeepAlive value in the HTTP header to False. By default, KeepAlive is True.
KeepAlive establishes a persistent connection to the server to facilitate subsequent requests.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Headers <System.Collections.IDictionary>
Specifies the headers of the web request. Enter a hash table or dictionary.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-OutFile <System.String>
Saves the response body in the specified output file. Enter a path and file name. If you omit the path, the
default is the current location.
Required? false
Position? 13
Default value Get
Accept pipeline input? False
Accept wildcard characters? false
-Method <System.String>
Specifies the method used for the web request.
Required? false
Position? 9
Default value Get
Accept pipeline input? False
Accept wildcard characters? false
-OauthAccessToken <System.String>
The OAuth access token to use for the signature.
Required? false
Position? 4
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-OauthAccessTokenSecret <System.Security.SecureString>
The OAuth access token secret to use for the signature.
Required? false
Position? 5
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-OauthConsumerKey <System.String>
The OAuth consumer key to use for the signature.
Required? true
Position? 2
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-OauthConsumerSecret <System.Security.SecureString>
The OAuth consumer secret to use for the signature.
Required? true
Position? 3
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-OauthParameters <System.Collections.Hashtable>
Any additional parameters to include in the OAuth signature.
Required? false
Position? 8
Default value @{}
Accept pipeline input? False
Accept wildcard characters? false
-OauthSignatureMethod <System.String>
The OAuth signature hash method to use.
Required? false
Position? 6
Default value HMAC-SHA1
Accept pipeline input? False
Accept wildcard characters? false
-OauthVersion <System.String>
The OAuth signature version to use.
Required? false
Position? 7
Default value 1.0
Accept pipeline input? False
Accept wildcard characters? false
-Proxy <System.String>
Specifies that the cmdlet uses a proxy server for the request, rather than connecting directly to the Internet
resource. Enter the URI of a network proxy server.
Required? false
Position? 12
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ProxyCredential <System.Management.Automation.PSCredential>
Specifies a user account that has permission to use the proxy server that is specified by the Proxy parameter.
The default is the current user.
Type a user name, such as "User01" or "Domain01\\User01", or enter a PSCredential object, such as one generated
by the Get-Credential cmdlet.
This parameter is valid only when the Proxy parameter is also used in the command. You cannot use the
ProxyCredential and ProxyUseDefaultCredentials parameters in the same command.
Required? false
Position? 13
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ProxyUseDefaultCredentials <System.Management.Automation.SwitchParameter>
Indicates that the cmdlet uses the credentials of the current user to access the proxy server that is
specified by the Proxy parameter.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Uri <System.Uri>
Specifies the Uniform Resource Identifier (URI) of the Internet resource to which the web request is sent.
Required? true
Position? 1
Default value None
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
System.String
NOTES
-------------------------- Example 1 --------------------------
PS C:\\> Invoke-PSAuthRestMethod -Uri 'https://contoso.com/oauth2/api/get' `
-OauthConsumerKey 'MyConsumerKey' `
-OauthConsumerSecret (ConvertTo-SecureString -String 'MySecret' -AsPlainTextForce) `
-Method 'Get'
Execute Invoke-RestMethod adding an Authorization header containing an OAuth 1.0 signature.
RELATED LINKS