I tried following the post to access the asana api found here Access ASANA via windows powershell using APIKEY . Below is the code I'm using and the error message I receive:
$apikey="******.***************"
#Add colon
$authinfo=$apikey+":";
$string1 = $authinfo
Write-Host $string1 -ForeGroundColor Green
#Encoding format
$enc = [system.Text.Encoding]::UTF8
#get bytes
$data1 = $enc.GetBytes($string1)
#convert to 64 bit
$mykey=[System.Convert]::ToBase64String($data1)
Write-Host $mykey -ForeGroundColor Green
$url="https://app.asana.com/api/1.0/users"
$request = [System.Net.WebRequest]::Create($url)
$authorization = "Authorization: Basic " + $myKey
Write-Host $authorization -ForeGroundColor Green
$request.Headers.Add($authorization)
#$request.Headers.Add("Authorization: BASIC $mykey")
$response = $request.GetResponse()
Write-Host $Response -ForeGroundColor Green
and receive the following error:
Exception calling "GetResponse" with "0" argument(s): "The operation has timed out" At line:26 char:1 + $response = $request.GetResponse() + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : WebException