I was trying to get data from a vendor's REST API from Power BI.
When getting data, under Web API, it keeps throwing this error. See attached screenshot.
It is a POST method where you can filter by any field in the response body (yet I'm not passing any this time).
The query I am using to get a response is as below. Sorry I forgot where I found it.
let
apiUrl = "my_api_url",
token="my_api_key",
options = [Headers=[Authorization="Bearer " & token ]],
result = Json.Document(Web.Contents(apiUrl , options))
in
#"result"
You need to include ApiKeyName in your request rather than building up Authorization yourself.
For example:
let Source = Web.Contents(apiURL, [ApiKeyName="mauapikey"]),
Also see Microsoft Documentation or someone's blog post
I recently ran into a similar problem, but was able to find the solution:
If your authorization must be in the header, you were nearly there with your solution. In my case, the authorization was required to be in the header, but utilized Basic Authentication rather than Token. I believe if you do the following to your code, it will work
let
apiUrl = "my_api_url",
token="my_api_key",
options = [Headers=[#"Authorization"="Bearer " & token ]],
result = Json.Document(Web.Contents(apiUrl , options))
in
#"result"
The only thing added is the '#' before the Authorization and then surrounding Authorization with double quotes "Authorization".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With