Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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 @Anonymous 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 @Anonymous 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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
7 | |
6 |