Invoke-PokeAPIRequest

SYNOPSIS

Makes an API request

SYNTAX

__AllParameterSets

Invoke-PokeAPIRequest [[-Method] <string>] [-ResourceUri] <string> [[-UriFilter] <hashtable>]
 [-AllResults] [-NoCache]

ALIASES

This cmdlet has the following aliases,

  • Invoke-PokeRequest

DESCRIPTION

The Invoke-PokeAPIRequest cmdlet invokes an API request to PokeAPI.

This is an internal function that is used by all public functions

PokeAPI is a consumption-only API so only GET requests are supported (All other methods are blocked by PokeAPI)

EXAMPLES

EXAMPLE 1

Invoke-PokeAPIRequest -Method GET -ResourceUri '/pokemon' -UriFilter $PSBoundParameters

Invoke a rest method against the defined resource using any of the provided parameters

Example: Name Value —- —– Method GET Uri https://pokeapi.co/api/v2/pokemon/?limit=100&offset=20

EXAMPLE 2

Invoke-PokeAPIRequest -ResourceUri '/pokemon' -AllResults

Returns every pokemon resource by following each next page link

PARAMETERS

-AllResults

Returns all items from an endpoint by following the next page links

When using this parameter there is no need to use the Offset parameter. If the Limit parameter is not defined then 100 resources per page are requested.

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

-Method

Defines the type of API method to use

Allowed values: ‘GET’

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

-NoCache

Bypasses the in-memory response cache

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

-ResourceUri

Defines the resource uri (url) to use when creating the API call

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

-UriFilter

Used with the internal function [ ConvertTo-PokeAPIQueryString ] to combine a functions parameters with the ResourceUri parameter.

This allows for the full uri query to occur

The full resource path is made with the following data $PokeAPIModuleBaseUri + $ResourceUri + ConvertTo-PokeAPIQueryString

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

OUTPUTS

NOTES

The Invoke-PokeRequest alias & the AllPages parameter alias are kept for older scripts.