All I get with this service is a “401 Unauthorized.” I’ve defined an auth_token
and included that in the query string.
#$ApiKey = 'TESTAPIKEY'; # Redacted
$ApiKey = 'PRODUCTIONAPIKEY'; # Redacted
$AuthToken = 'AUTHTOKEN'; # Redacted
$Headers = @{ 'X-Mashape-Authorization' = $ApiKey; };
$Uri = '{0}?auth_token={1}&url={2}' -f $ServiceRoot, $AuthToken, 'google.com';
$Result = Invoke-RestMethod -Method Get -Uri $Uri -Headers $Headers -Verbose;
Write-Output -InputObject $Result;```
The result is simply:
```Invoke-RestMethod : The remote server returned an error: (401) Unauthorized.
At line:9 char:1
+ Invoke-RestMethod -Method Get -Uri $Uri -Headers $Headers -Verbose;
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:Htt
pWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe
ll.Commands.InvokeRestMethodCommand```
Join in the discussion - add comment below:
Hey. Thanks for using my APIs. May I ask what auth_token you are using? you can email me directly at enclout@gmail.com