ConvertTo-BirdWeatherRESTQueryString

SYNOPSIS

Converts uri filter parameters into a query string

SYNTAX

__AllParameterSets

ConvertTo-BirdWeatherRESTQueryString [[-UriFilter] <hashtable>] [[-MultiValueParameter] <string[]>]

ALIASES

This cmdlet has the following aliases,

  • ConvertTo-BWRQueryString

DESCRIPTION

The ConvertTo-BirdWeatherRESTQueryString cmdlet converts & formats a hashtable of parameters into a url encoded query string that is later appended to the resource uri of an API call

This is an internal helper function that is used by Invoke-BirdWeatherRESTRequest

Conversion rules: - $null values are skipped - Arrays are sent as comma separated lists - Dates are converted to UTC and formatted as yyyy-MM-ddTHH:mm:ss.fffZ (ISO 8601) - Booleans are sent as lowercase true\false - Hashtables & objects are sent as compressed JSON

EXAMPLES

EXAMPLE 1

ConvertTo-BirdWeatherRESTQueryString -UriFilter @{ limit = 10; classification = 'bat','mammal' }

Returns ‘classification=bat,mammal&limit=10’

EXAMPLE 2

ConvertTo-BirdWeatherRESTQueryString -UriFilter @{ classification = 'bat','mammal' } -MultiValueParameter 'classification'

Returns ‘classification=bat&classification=mammal’

PARAMETERS

-MultiValueParameter

Defines the names of the UriFilter keys that must be sent as repeated key\value pairs instead of a comma separated list

Type: System.String[]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 1
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-UriFilter

Hashtable of query string parameters

Type: System.Collections.Hashtable
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: false
  ValueFromPipeline: true
  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

System.Collections.Hashtable

OUTPUTS

NOTES

N/A