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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.