Forum Discussion

shuaho's avatar
shuaho
Frequent Visitor
8 years ago
Solved

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...
  • Anonymous's avatar
    Anonymous
    7 years ago

    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