Public/Get-GW2TokenInfo.ps1
|
<#
.SYNOPSIS Retrieves the account's token info using a provided API key. .DESCRIPTION Calls the Guild Wars 2 API v2 /account/tokeninfo endpoint and returns the deserialized object containing the account's token info. The function issues an authenticated GET request. .PARAMETER APIKey The Guild Wars 2 API key (string) to authenticate the request. Requires 'account' and 'progression' scopes. .EXAMPLE Get-GW2TokenInfo -APIKey 'your_api_key_here' .NOTES - Requires network access to api.guildwars2.com. - Ensure the API key has the necessary scopes. #> function Get-GW2TokenInfo { param ( [string]$APIKey ) $headers = @{ "Authorization" = "Bearer $APIKey" } $url = "https://api.guildwars2.com/v2/tokeninfo" $response = Invoke-RestMethod -Uri $url -Method Get -Headers $headers return $response } |