Get-APITCGResponseHeader
SYNOPSIS
Gets the value of a header from the headers of a web response
SYNTAX
__AllParameterSets
Get-APITCGResponseHeader [[-Headers] <Object>] [-Name] <string>
ALIASES
This cmdlet has the following aliases,
- None
DESCRIPTION
The Get-APITCGResponseHeader cmdlet reads one header from the headers of a web response and always returns the value as a single string (or $null when the header does not exist)
Windows PowerShell & PowerShell 7+ expose the response headers differently, both for successful responses & for the responses of failed requests:
Windows PowerShell success Dictionary[string,string]
Windows PowerShell error WebHeaderCollection (System.Net.HttpWebResponse)
PowerShell 7+ success Dictionary[string,string[]]
PowerShell 7+ error HttpResponseHeaders (System.Net.Http.HttpResponseMessage)
Multiple values are joined with a comma & a space
This is an internal helper function that is used by Invoke-APITCGRequest & Test-APITCGAPIKey
EXAMPLES
EXAMPLE 1
Get-APITCGResponseHeader -Headers $WebResponse.Headers -Name 'RateLimit'
Returns ‘limit=300, remaining=292, reset=28’
PARAMETERS
-Headers
The headers object of a web response
Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Name
The name of the header, the name is not case sensitive
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
OUTPUTS
System.String
NOTES
N/A