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
NathanV8
Frequent Visitor

Data Web API Refresh Issue

Hello All, 
I have a dillemma id like some asisstance with. I have the age old Web.Contents scheduled refresh issue when i build reports from a specific source (I pretty much only work with htis source. 

I have the below M Code for the data 

 

 

let

Source = Csv.Document(Web.Contents("Put Helm CONNECT CSV Connection String Here", [ApiKeyName= "apikey"]),[Delimiter=",", Encoding=65001, QuoteStyle=QuoteStyle.Csv]),#"Promoted Headers" = Table.PromoteHeaders(Source)

in

#"Promoted Headers"

 

 


But witht he above I subsequantly cannot refresh this on the service and the onlyw ay i could figure to make this work is via the below by addine api within the query 

 

 

let
    ApiKey = "your_api_key_here",
    Url = "CSV String here&apikey=" & ApiKey, //keep the &apikey=
    Source = Csv.Document(Web.Contents(Url), [Delimiter=",", Encoding=65001, QuoteStyle=QuoteStyle.Csv]),
    #"Promoted Headers" = Table.PromoteHeaders(Source)
in
    #"Promoted Headers"

 

 

 

But this obviousis not the most secure way pass the API key this way. 

Does anyone have any better solutions i could try to be more secure witht he API key as Im not always the one witht he key so the ideal situation would be to prompt thd user to place the key in when they get the file to upload to there own service and it then allows scheduled refresh


I have done some research on the topic and mosta  referencing the jscontents and some arent working for (inc the Skip test connection)

 

1 REPLY 1
Anonymous
Not applicable

Hi @NathanV8 

 

What error did you meet when using the first method with the parameter ApiKeyName in Web.Contents? According to the official document, this method seems to work. Web.Contents - PowerQuery M | Microsoft Learn

vjingzhanmsft_0-1707286121561.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

 

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