Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
Following multiple attempts and researches, the problem persists.
I am trying to connect to a business management system and i constantly have issues with authorisation.
This is what i use (Example 2🙂
let
apiToken = "********************************",
url = "https://********.**********.com/api/tasks",
query = [
start = "2022-01-01",
end = "2022-01-31"
],
headers = [
Authorization = "Token " & apiToken,
#"Content-Type" = "application/json"
],
response = Web.Contents(
url,
[
Headers = headers,
Query = query
]
),
jsonResponse = Json.Document(response)
in
jsonResponse
and that is what i get
i changed to anonymous
and getting this one
Then i have tried this version which i found here:
let
apiToken = "************************",
site = "https://****.*********.com/",
url = "api/tasks",
query = [
start = "2022-01-01",
end = "2022-01-31"
],
headers = [
Authorization = "Token " & apiToken,
#"Content-Type" = "application/json"
],
response = Web.Contents(
site,
[
RelativePath = url,
Headers = headers,
Query = query
]
),
jsonResponse = Json.Document(response)
in
jsonResponse
and i'm still getting the same authentication errors.
Can anyone spot an issue with the code? could it be the actual API having issues?
Many thanks!
Solved! Go to Solution.
Many thanks @v-eqin-msft even though, in the end, i used anonymous. my mistake was that i was using the entire API address in the level where i should have only used the link to the site.
Have another concern now. Protecting the API Token. Currently reading this one https://community.powerbi.com/t5/Developer/Protection-of-API-Keys-Stored-in-Parameter/m-p/1564020
and i'll keep searching.
Hi @kalspiros ,
To my knowledge, since you have such header:
Authorization = "Token " & apiToken
The data source requires credentials, so Anonymous is not applicable. Please try other authentication methods instead :
Anonymous: Select this authentication method if the web page doesn't require any credentials.
Windows: Select this authentication method if the web page requires your Windows credentials.
Basic: Select this authentication method if the web page requires a basic user name and password.
Web API: Select this method if the web resource that you’re connecting to uses an API Key for authentication purposes.
Organizational account: Select this authentication method if the web page requires organizational account credentials.
Refer to:
Power Query Web connector - Power Query | Microsoft Docs
Solved: Re: Pull data from RESTful API with token authenti... - Microsoft Power BI Community
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Many thanks @v-eqin-msft even though, in the end, i used anonymous. my mistake was that i was using the entire API address in the level where i should have only used the link to the site.
Have another concern now. Protecting the API Token. Currently reading this one https://community.powerbi.com/t5/Developer/Protection-of-API-Keys-Stored-in-Parameter/m-p/1564020
and i'll keep searching.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.