Skip to content

Instantly share code, notes, and snippets.

@ctigeek
Last active February 29, 2016 16:02
Show Gist options
  • Save ctigeek/8ff0aa50df4499258391 to your computer and use it in GitHub Desktop.
Save ctigeek/8ff0aa50df4499258391 to your computer and use it in GitHub Desktop.
Auth and other headers for making REST Request in powershell...
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$dict = @{Authorization=("Basic {0}" -f $base64AuthInfo)}
$dict.Add("Accept", "application/json")
$response = Invoke-RestMethod -Uri $Url -Method Get -ContentType "application/json" -Headers $dict
$response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment