I have an API Proxy in Apigee which is authenticated with an API key. I'm passing the key with my HTTP request header using cURL, with this command:
curl -v -H "apikey: my_key" http://api_org-test.apigee.net/v1/helloapikey
I get this error:
Invoke-WebRequest : Cannot bind parameter 'Headers'. Cannot convert the
"apikey: my_key" value of type "System.String" to
type "System.Collections.IDictionary".
When I modify my policy to look for the key in query parameter rather than the header, it works fine. Am I missing something here?
Try this:
curl -v -H @{'apikey' = 'my_key'} http://api_org-test.apigee.net/v1/helloapikey
Note:
curl
is an alias for the Invoke-WebRequest
cmdlet:
Get-Alias curl
output:
CommandType Name
----------- ----
Alias curl -> Invoke-WebRequest