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

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.

Reply
Anonymous
Not applicable

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
Resident Rockstar
Resident Rockstar

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"]],

 

Anonymous
Not applicable

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors