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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

API Key was expected to be provided in the header for this call

I've connected my dashboard to a source as explained by the provider here and it loads the data and refreshes fine in desktop. But when I upload it and try to shcedule a refresh it gives me this error:

"Failed to update data source credentials: Web.Contents failed to get contents from 'https://interact.leadforensics.com/WebApi_v2/Business/GetAllBusinesses?datefrom=01-01-2010%2000:00:0...' (400): The Lead Forensics API Key was expected to be provided in the header for this call." 
power bi.jpg

1 ACCEPTED SOLUTION
Anonymous
Not applicable

The solution to this problem was changing the M Query as below:

 

let 
vBaseUrl = "https://interact.leadforensics.com",
vPath = "WebApi_v2/Visit/GetAllVisits?datefrom=01-01-2020 00:00:00&dateto=31-12-2030 23:59:59&pagesize=999999&pageno=1", vHeaders = [#"Authorization-Token"="THIS IS WHERE I PUT THE AUTH TOKEN", #"ClientID"="THIS IS WHERE I PUT THE ID"],
Source = Web.Contents ( vBaseUrl, [RelativePath=vPath, Headers=vHeaders] ),
Json = Json.Document ( Source ),
SiteVisitList = Json[SiteVisitList],
#"Converted to Table" = Table.FromList(SiteVisitList, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
in 
#"Converted to Table"

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

The solution to this problem was changing the M Query as below:

 

let 
vBaseUrl = "https://interact.leadforensics.com",
vPath = "WebApi_v2/Visit/GetAllVisits?datefrom=01-01-2020 00:00:00&dateto=31-12-2030 23:59:59&pagesize=999999&pageno=1", vHeaders = [#"Authorization-Token"="THIS IS WHERE I PUT THE AUTH TOKEN", #"ClientID"="THIS IS WHERE I PUT THE ID"],
Source = Web.Contents ( vBaseUrl, [RelativePath=vPath, Headers=vHeaders] ),
Json = Json.Document ( Source ),
SiteVisitList = Json[SiteVisitList],
#"Converted to Table" = Table.FromList(SiteVisitList, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
in 
#"Converted to Table"

 

lbendlin
Super User
Super User

you may have had an active session in the desktop from a prior authentication.  That won't work in the service.  Provide the key as indicated.

Anonymous
Not applicable

It works in desktop (and continues working), cause i set it up. No one was using this source in the company before. But just to be sure, I have cleared all existing connections and set it up again and it works in Desktop. But not in the service.
If you click on the link I provided you will see what information do they provide i.e. Authorization Token and Client ID. They don't give you the API key name and it is not required to connect to the source.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.