cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Gudmas Frequent Visitor
Frequent Visitor

Unable to authenticate web api in the service.

I am unable to authenticate web api source.  The authentication uses Bearer authentication and I am able to get data in PBI Desktop.
Here is some sample code from power query:

Source = Json.Document(Web.Contents(StaticPathVar, [Headers=[Authorization="Bearer xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",RelativePath = "?createdAfter=" & Year & "-" & FromMonth & before & Year & "-" & ToMonth & url]])),

 

As one can see the api key is provided in the code.  But PBI Service want's to authenticate the datasource seperatly as is normal with sql data, excel data, csv files and so forth.  

Authenticate.PNG

If one presses the edit credentials the pop window askes for authentication method.

Authenticate2.PNG

But there is no way to authenticate the web api datasource like this in the service.

 

Are there any work around to bypass this authentication.

2 REPLIES 2
blopez11 Established Member
Established Member

Re: Unable to authenticate web api in the service.

Instead of passing your parameters using RelativePath, use Query instead

 

vOptions = [RelativePath=vPath, Query=[page=Text.From(vPage), pagesize=Text.From(vPageSize)], Headers=[Accept="...-v1+json"]],

 

Gudmas Frequent Visitor
Frequent Visitor

Re: Unable to authenticate web api in the service.

That did not do the trick - but i am problably doing this all rong.  Tried this code

Source = Json.Document(Web.Contents(StaticPathVar, [Headers=[Authorization="Bearer xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",Query = "?createdAfter=" & Year & "-" & FromMonth & before & Year & "-" & ToMonth & ur

]])

),

...some other code.

Helpful resources

Announcements
October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Top Kudoed Authors
Users Online
Currently online: 153 members 1,621 guests
Please welcome our newest community members: