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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
shuaho
Frequent Visitor

dataset created from data pulled from restful service can not refresh

I am using the dataset created using M language to pull data from a restful service.  When publish to app.powerbi.com,  the refresh failed.  And the reports only include data before published.  

How do I setup to refresh the report?

 

Thanks 

 

Below is the script to get data:

 

let
Query2 = let

url="http://api.AAAAA.com/api/1.0/authentication",
body = "{
""userName"":""AAAA"", 
""password"":""BBBBBB"" 
}",

jsonResult = Json.Document(Web.Contents(url,[Headers =[#"Content-Type"="application/json"],Content = Text.ToBinary(body) , Timeout=#duration(0,2,0,0)])), 
token = jsonResult[accessToken],
location_url = "http://api-test.AAAAA.com/api/1.0/sites",
sites = Json.Document(Web.Contents(location_url,[Headers =[Accept="application/json", Authorization=token]]))
in
sites[result],  

 

refresh error message

 

Data source error:Scheduled refresh has been disabled because at least one data source is missing credentials. For refresh to succeed, you must provide credentials for all data sources. Please enter the data source credentials on the dataset settings page and then reactivate scheduled refresh.
Cluster URI:WABI-CANADA-CENTRAL-redirect.analysis.windows.net
Activity ID:beb6f600-7d62-4776-a3b0-a85c2667ce60
Request ID:e3b456cd-296a-22d5-ea94-8eaa815f759e
Time:2018-10-26 02:09:01Z
1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @shuaho,

 

I'd like to suggest you move 'get token' method to original query instead use sub query, current power bi service seems not support custom function.

 

let
	url="http://api.AAAAA.com/api/1.0/authentication",
	body = "[{""userName"":""AAAA"", ""password"":""BBBBBB""}]",
	jsonResult = Json.Document(Web.Contents(url,[Headers =[#"Content-Type"="application/json"],Content = Text.ToBinary(body) , Timeout=#duration(0,2,0,0)])), 
	token = jsonResult[accessToken],
	location_url = "http://api-test.AAAAA.com/api/1.0/sites",
	Source= Json.Document(Web.Contents(location_url,[Headers =[Accept="application/json", Authorization=token]]))[result]
in
	Source

 

BTW, have you configure datasource credentials with 'anonymous' mode on power bi service side?

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @shuaho,

 

I'd like to suggest you move 'get token' method to original query instead use sub query, current power bi service seems not support custom function.

 

let
	url="http://api.AAAAA.com/api/1.0/authentication",
	body = "[{""userName"":""AAAA"", ""password"":""BBBBBB""}]",
	jsonResult = Json.Document(Web.Contents(url,[Headers =[#"Content-Type"="application/json"],Content = Text.ToBinary(body) , Timeout=#duration(0,2,0,0)])), 
	token = jsonResult[accessToken],
	location_url = "http://api-test.AAAAA.com/api/1.0/sites",
	Source= Json.Document(Web.Contents(location_url,[Headers =[Accept="application/json", Authorization=token]]))[result]
in
	Source

 

BTW, have you configure datasource credentials with 'anonymous' mode on power bi service side?

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft   thanks for answering!

 

I need to set a 'GET' request reachable endpoint to make the refresh work. 

But you answer helped me,  thanks!

@shuaho@v-shex-msft  hi guys,

 

I'm facing the same problem with two same queries: the first to get the token and the second to get some data. No matter trying to refresh dataset from power bi desktop, but trying to refresh it on power bi service I've got the same credentials issue, also configuring datasource credentials with 'anonymous' mode. Smiley Frustrated

 

Could you please give me a suggestion about this?

 

Thanks a lot in advance

Luca

Here the solution that actually fixed it for me

https://community.powerbi.com/t5/Service/Anonymous-access/td-p/19136

 

Luca

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors