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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
ChrisWeeks92
Helper I
Helper I

Refreshing data from REST API

Hi

 

I have a REST API setup as one of my datasets.  What is the best way to get it to schedule refreshes, say 3x a day like 8am,12pm,3pm to capture the latest data in my report.  

 

My REST API code is as follows.  Is there a line i should add to the API code or any other way that i can get this to update automatically. 

 

let    
url = "API LINK HERE", 
body = "{""Username"": ""xxxxxxxx"", ""Password"": ""xxxxxxxx"", ""CustomerID"": ""x""}",   

Source  = Json.Document(Web.Contents(url,   [ 
     Headers = [#"Content-Type"="application/json"],
     Content=Text.ToBinary(body)   
]   
)   
),
in
    #"Renamed Columns1"
4 REPLIES 4
v-micsh-msft
Microsoft Employee
Microsoft Employee

Have you tried to follow the article below to configure Shceduled Refresh?

Configuring scheduled refresh

 

If yes, what is the error messages?

 

If there are errors popped out, please share it here.

 

The code you posted should be the connection string stored in Power BI Desktop, which belongs to the web contents, please check the article below and see if it would work in your scenario:

Dynamic Web.Contents() and Power BI Refresh Errors

 

Regards,

Michael

Hi 

 

Sorry for the delay, i have been busy on other projects.  

 

I have just tried Scheduled refresh as below.  It comes back with 

 

Failed to update data source credentials: Web.Contents failed to get contents from 'API URL' (405): Method Not AllowedHide details

 

I do have a personal gateway setup for this as i think it mentions that it would need a personal data gateway too but it comes back with "Your data source can't be refreshed because the credentials are invalid. Please update your credentials and try again." I have tried my Microsoft ID, API username/password and my computer login details.  so any help will be much appreciated to where i am going wrong.

 

I don't quite understand where your second article is referencing in my case, what should i add/change in my file to refresh the API without actually opening the file and refreshing the data.  

 

Thanks

Chris

Did this get resolved? I am having same issue. 

Yes this did get resolved.  It was the configuration of the API on the developers side.  The developer had fixed the API for me.  

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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