Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello, I am new to the world of Power Query and M... Power BI for that matter.
I am trying to create a data connector to our REST API and running into some difficulty.
When I login authenticating via UsernamePassword I get a table back with my hash token in the second column, fifth row down.
The table columns are Name, Value and the row is Name = hash and Value = "sdda009dwdeweassdsdsas" (for example).
I am trying to add that hash back into my table request as follows. I apologize in advance for what you're about to see as this is my first day in power query:
let
Credential = Extension.CurrentCredential(),
CredentialConnectionString = [ UID = Credential[Username], PWD = Credential[Password] ],
source = Web.Contents(url & "/api/login/" & CredentialConnectionString[UID] & "/" & CredentialConnectionString[PWD], [ Headers = DefaultRequestHeaders ]),
hashrow = source{5},
hash = hashrow{1},
report = Web.Contents(url & "/api/report/1/output/Reports/Sugna66/test_test?auth=" & [hash], [ Headers = DefaultRequestHeaders ]),
json = Json.Document(report)
in
source;
As you can see I don't really understand the table calls yet. Any help with this would be appreciated.
Cheers,
Solved! Go to Solution.
Thanks,
eventually, I figured it out:
SynDNAImpl = (url as text) =>
let
Credential = Extension.CurrentCredential(),
CredentialConnectionString = [ UID = Credential[Username], PWD = Credential[Password] ],
login = Record.ToTable(Json.Document(Web.Contents(url & "/api/login/" & CredentialConnectionString[UID] & "/" & CredentialConnectionString[PWD], [ Headers = DefaultRequestHeaders ]))),
FilterLogin = Table.SelectRows(login, each _[Name] = "hash" ),
hash = List.First(Table.Column(FilterLogin, "Value")),
source = Web.Contents(url & "/api/report/1/output/Reports/Angus/test_test?auth=" & hash, [ Headers = DefaultRequestHeaders ]),
json = Json.Document(source)
in
json;
It seems like much but it worked for logging in grabbing a report.
Bump? Any love here?
@sugna66 ,
What data format and fields would your REST API return? Power BI Desktop returns all the data the REST API provides.
Regards,
Lydia
Thanks,
eventually, I figured it out:
SynDNAImpl = (url as text) =>
let
Credential = Extension.CurrentCredential(),
CredentialConnectionString = [ UID = Credential[Username], PWD = Credential[Password] ],
login = Record.ToTable(Json.Document(Web.Contents(url & "/api/login/" & CredentialConnectionString[UID] & "/" & CredentialConnectionString[PWD], [ Headers = DefaultRequestHeaders ]))),
FilterLogin = Table.SelectRows(login, each _[Name] = "hash" ),
hash = List.First(Table.Column(FilterLogin, "Value")),
source = Web.Contents(url & "/api/report/1/output/Reports/Angus/test_test?auth=" & hash, [ Headers = DefaultRequestHeaders ]),
json = Json.Document(source)
in
json;
It seems like much but it worked for logging in grabbing a report.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 8 | |
| 7 |