Get-PokeAPIResponse

SYNOPSIS

Gets a single response from PokeAPI

SYNTAX

__AllParameterSets

Get-PokeAPIResponse [-Uri] <string> [[-CacheMinutes] <int>] [-NoCache]

ALIASES

This cmdlet has the following aliases,

  • Get-PokeResponse

DESCRIPTION

The Get-PokeAPIResponse cmdlet requests a single uri from PokeAPI and converts the JSON response into objects.

PokeAPI asks developers to locally cache resources. Successful responses are cached in memory for one hour by default. Cached values are stored as raw JSON so every call returns new objects.

Requests that are rate limited (429), fail with a temporary server error (502, 503, 504), or fail without a response (network errors) are retried up to 3 times, the Retry-After header is respected when PokeAPI sends one.

The response body is always decoded as UTF-8 which avoids character encoding issues in Windows PowerShell 5.1.

This is an internal function that is used by Invoke-PokeAPIRequest

EXAMPLES

EXAMPLE 1

Get-PokeAPIResponse -Uri 'https://pokeapi.co/api/v2/pokemon/ditto/'

Gets the response for the defined uri

EXAMPLE 2

Get-PokeAPIResponse -Uri 'https://pokeapi.co/api/v2/pokemon/ditto/' -NoCache

Gets a fresh response for the defined uri and does not use the cache

PARAMETERS

-CacheMinutes

Defines how long a response stays in the cache

Default value: 60

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

-NoCache

Bypasses the in-memory cache without reading or updating a cached entry

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: ''

-Uri

Defines the full uri to request

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

NOTES

The Get-PokeResponse alias is kept for older scripts.