cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shuaho Frequent Visitor
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

Accepted Solutions
Highlighted
Community Support Team
Community Support Team

Re: dataset created from data pulled from restful service can not refresh

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 Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |
4 REPLIES 4
Highlighted
Community Support Team
Community Support Team

Re: dataset created from data pulled from restful service can not refresh

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 Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |
shuaho Frequent Visitor
Frequent Visitor

Re: dataset created from data pulled from restful service can not refresh

@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!

Re: dataset created from data pulled from restful service can not refresh

@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

Re: dataset created from data pulled from restful service can not refresh

Here the solution that actually fixed it for me

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

 

Luca