Last active
September 20, 2017 19:15
-
-
Save jdmills-edu/1b2812a5d5d77173480a6dd69ddda190 to your computer and use it in GitHub Desktop.
A PowerShell script that returns a Zendesk ticket of a given ID.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[Parameter(Mandatory=$true)][Int32]$ticketID | |
) | |
#Zendesk API Connection Headers Referencing System Environmental Variables for username and API token. | |
$headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($env:ZendeskAPI_Username):$($env:ZendeskAPI_Token)"));} | |
$ticketsURI = "https://yourdomain.zendesk.com/api/v2/tickets/$ticketID.json" | |
$ticket = Invoke-RestMethod -Uri $ticketsURI -Method Get -Headers $headers -ContentType "application/json" | |
$ticket = $ticket.ticket | |
return $ticket |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment