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 there,
I have the following question: I need to get access to an API and altough I can get it to work in Postman, I can't seem to figure it out how to run it in Power BI.
I have the following info:
API-key: 1938adklw-2020etbw-3abca-9add0-433435 (it is a fictive key...)
In Postman I put a POST request with the following URL (also fictive):
https://worksauce.matrix2.de/auth/login/matrix2pbi/apiKey?
And in my headers I put:
Key = apiKey
Value = 1938adklw-2020etbw-3abca-9add0-433435
When I press Send in Postman, I get an access token from Postman, something like:
Solved! Go to Solution.
Hi all, just to give an update, I managed to get it to work with the following script:
let
GetJson = Web.Contents(
"https://company.abcde.com/",
[
RelativePath=tokenURL,
Headers = [#"Accept"="application/json", #"Content-Type"="application/json"],
Content = Text.ToBinary("token=xxxxxxxx&iat=xxxxx*&resource=xxxxx&grant_type=client_credentials")
]
),
FormatAsJson = Json.Document(GetJson),
token = FormatAsJson[token],
// add token in the URL:
Source = Json.Document(
Web.Contents(
"https://company.abcde.com/",
[
RelativePath=ListURL,
Headers=[Authorization="Bearer "&token]
]
)
),
Navigation = Source[items],
#"Converted to table" = Table.FromList(Navigation, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
#"Converted to table"
The thing betweens " in the Content = part is not really important according to another topic of mine: https://community.powerbi.com/t5/Power-Query/Refreshable-token-API-Credential-Errors-when-trying-to-...
Hi all, just to give an update, I managed to get it to work with the following script:
let
GetJson = Web.Contents(
"https://company.abcde.com/",
[
RelativePath=tokenURL,
Headers = [#"Accept"="application/json", #"Content-Type"="application/json"],
Content = Text.ToBinary("token=xxxxxxxx&iat=xxxxx*&resource=xxxxx&grant_type=client_credentials")
]
),
FormatAsJson = Json.Document(GetJson),
token = FormatAsJson[token],
// add token in the URL:
Source = Json.Document(
Web.Contents(
"https://company.abcde.com/",
[
RelativePath=ListURL,
Headers=[Authorization="Bearer "&token]
]
)
),
Navigation = Source[items],
#"Converted to table" = Table.FromList(Navigation, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
#"Converted to table"
The thing betweens " in the Content = part is not really important according to another topic of mine: https://community.powerbi.com/t5/Power-Query/Refreshable-token-API-Credential-Errors-when-trying-to-...
@Gjakova similar solution is available at below link. i also used the same for my data connection
https://community.powerbi.com/t5/Power-Query/Pull-data-from-a-REST-API-Authentication/td-p/246006
Proud to be a Super User!
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.
User | Count |
---|---|
107 | |
99 | |
76 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |