I'd like to pull in some data from Zendesk using PowerShell. I am using the example found. Unfortunately, there was an issue "error: cannot authenticate you" The token and email address are correct.
Is there a resolution to this issue or another way to pull the data?
Here's the corrected code:
$Username = "username@domain.com/token"$Token = "kasjdfkljasdfkjds"$Base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($Username):$($Token)"))$params = @{Uri = "https://{subdomain}.zendesk.com/api/v2/requests.json"Method = 'Get'Headers = @{Authorization = "Basic $Base64AuthInfo"}}$result = Invoke-RestMethod @params$Tickets = $result.tickets$TicketsMake sure to replace {subdomain} with your actual Zendesk subdomain, and ensure that $Username and $Token contain the correct values for your Zendesk account.
Also, note that $result is being used to store the result of Invoke-RestMethod, but in your original code, you didn't assign the result to the $result variable. I've added that assignment in the corrected code above.