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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
MCPowerBI
Regular Visitor

Refresh datasource when data comes from post api

I have writen a small m script that gets its data from a post call to an api:

 

let
   url="https://this.isaurl.com",
   body =  "
         {
            ""Id"":""Id123456""
            ""Authenticator"": ""AUTH_KEY"" 
         }
   ",
   Data=Web.Contents(url,
   [RelativePath="My/Relative/Path",
   Content=Text.ToBinary(body),
   Headers=[#"Content-Type"="application/json"]
   ]),
   DataRecord = Json.Document(Data),
in
   DataRecord

 

In the powerbi desktop app there is no problem refreshing the query.

When the report is published and I try to refresh on the powerbi service.

The given error is:

 

The credentials provided for the Web source are invalid.

 

I have found these blog posts and followed them, but with no luck

- https://blog.crossjoin.co.uk/2016/08/23/web-contents-m-functions-and-dataset-refresh-errors-in-power... 

- https://blog.crossjoin.co.uk/2019/04/25/skip-test-connection-power-bi-refresh-failures/ 

- https://blog.crossjoin.co.uk/2016/08/16/using-the-relativepath-and-query-options-with-web-contents-i... 

- https://blog.crossjoin.co.uk/2021/01/10/handling-multiple-url-query-parameters-with-the-same-name-us... 

 

In short how can i refresh my dataset on the power bi service when the data cmoes from a post call

1 REPLY 1
v-yalanwu-msft
Community Support
Community Support

Hi, @MCPowerBI ;

Take a look at this document.

https://docs.microsoft.com/en-us/power-bi/connect-data/service-admin-troubleshooting-power-bi-person...

Error: The credentials provided for the dataset are invalid. Please update the credentials through a refresh or in the Data Source Settings dialog to continue.

Solution: If you get a credentials message, it could mean:

  • The usernames and passwords that you used to sign in to data sources aren't up to date. In Power BI, go to refresh settings for the dataset. In Manage Data Sources, select Edit credentials to update the credentials for the data source.

  • Mashups between a cloud source and an on-premises source, in a single query, fail to refresh in the gateway (personal mode) if one of the sources is using OAuth for authentication. An example of this issue is a mashup between CRM Online and a local SQL Server instance. The mashup fails because CRM Online requires OAuth.

    This error is a known issue, and it's being looked at. To work around the problem, have a separate query for the cloud source and the on-premises source. Then, use a merge or append query to combine them.

  • Use the same credentials and privacy level like in Power BI Desktop and Service.

You need to confirm that you are using the same permissions (same credentials type and same privacy level).  Then, you also need to confirm that the gateway is actually reaching the data - is it firewalled off or other security blocking it? 


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors