Add-BirdWeatherAPIKey

SYNOPSIS

Sets your station token & API key used to authenticate API calls

SYNTAX

Set (Default)

Add-BirdWeatherAPIKey [[-StationToken] <string>] [[-StationTokenSecureString] <securestring>]
 [[-ApiKey] <string>] [[-ApiKeySecureString] <securestring>] [-IsAdminToken]

ALIASES

This cmdlet has the following aliases,

  • Add-BWAPIKey
  • Set-BirdWeatherAPIKey
  • Set-BWAPIKey

DESCRIPTION

The Add-BirdWeatherAPIKey cmdlet sets the credentials that are used to authenticate API calls made to BirdWeather. The values are stored in memory as a SecureString

There are two credentials, one or both can be set: Station token - the token of your station, used by the REST API. It is the default -Token of every station function (Get-BirdWeatherRESTStationStats …) API key - the optional Bearer API key of the GraphQL API. The public data of the GraphQL API can be read without one

A station token can also be an administrator API token (use -IsAdminToken) that is obtained from the BirdWeather admin. It is sent in the Authorization header of REST requests & grants full access to every station. When it is used, the -Token parameter of the station functions must be set to the station ID. Treat an administrator API token like a password

When no value is defined the cmdlet prompts for the station token

EXAMPLES

EXAMPLE 1

Add-BirdWeatherAPIKey

Prompts to enter in the station token which will be stored as a SecureString

EXAMPLE 2

Add-BirdWeatherAPIKey -StationToken '12345'

Converts the string to a SecureString and stores it as the station token of the REST API

EXAMPLE 3

'12345' | Add-BirdWeatherAPIKey

The station token is passed in from the pipeline

EXAMPLE 4

Add-BirdWeatherAPIKey -ApiKey 'abcde'

Stores the Bearer API key of the GraphQL API

EXAMPLE 5

Add-BirdWeatherAPIKey -StationToken '12345' -ApiKey 'abcde'

Stores both the station token (REST) & the API key (GraphQL)

EXAMPLE 6

Add-BirdWeatherAPIKey -StationTokenSecureString (Read-Host -AsSecureString) -IsAdminToken

Stores an existing SecureString object as an administrator API token

PARAMETERS

-ApiKey

Plain text Bearer API key of the GraphQL API

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

-ApiKeySecureString

Input a SecureString object containing the GraphQL API key

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

-IsAdminToken

Defines that the station token is an administrator API token instead of a station token

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-StationToken

Plain text station token (or administrator API token) of the REST API

Values from the pipeline are used as the station token

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

-StationTokenSecureString

Input a SecureString object containing the station token

Type: System.Security.SecureString
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 1
  IsRequired: false
  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

System.String

OUTPUTS

NOTES

In Celerium.BirdWeatherREST the -ApiKey parameter was the station token & in Celerium.BirdWeatherGraphQL it was the GraphQL API key. In this module -StationToken is the station token & -ApiKey is the GraphQL API key