Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
sugna66
Frequent Visitor

First Data Connector Rest API

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,

 

 

 

 

1 ACCEPTED 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. 

View solution in original post

3 REPLIES 3
sugna66
Frequent Visitor

Bump? Any love here? 

Anonymous
Not applicable

@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. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors