Last active
September 20, 2017 19:14
-
-
Save jdmills-edu/4e7d39fd05a262a7704ec04c38ea2213 to your computer and use it in GitHub Desktop.
A PowerShell script that returns a Zendesk user.
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)][String]$userID | |
) | |
#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)"));} | |
$userURI = "https://yourdomain.zendesk.com/api/v2/users/$userID.json" | |
$user = Invoke-RestMethod -Uri $userURI -Method Get -Headers $headers -ContentType "application/json" | |
$user = $user.user | |
return $user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment