Forum Discussion

mvcsharepointde's avatar
2 years ago
Solved

Automatic Refresh for a model which get data from external API

I have  this Models to get data from external API:-

 

 

 

and this advance query:-

 

let
    body=Text.Combine({"sAPIKey=",ApiKey}),
	SourceAPILogin=Json.Document(
						Web.Contents(
								SmartAPI, 
								[
									RelativePath="apilogin",
									Headers=[Accept="application/json", #"Content-Type"="application/x-www-form-urlencoded",#"API-Key"=Token],
									Content=Text.ToBinary(body)
								]
								)
						),
    tblGetUID = Table.FromList(SourceAPILogin, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    expGetUID = Table.ExpandRecordColumn(tblGetUID, "Column1", {"UID", "LanguageCode", "DatabaseVersion"}, {"Column1.UID", "Column1.LanguageCode", "Column1.DatabaseVersion"}),
    GetUID = expGetUID{0}[Column1.UID],
    Source=Json.Document(
						Web.Contents(
								SmartAPI,
								[
									RelativePath = "gettimeledgerentry", //RESTAPI endpoint
									//Query = [#"Filter" ="WorkTypeCode LIKE 'Normal'"], // QueryParameters
								    Headers=[Accept="application/json", #"Content-Type"="application/json",#"API-Key"=Token, UID=GetUID, DeviceID=ApiKey] //Headers
								]
								)
						),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    //display all the columns from query
    Result=Table.ExpandRecordColumn( #"Converted to Table","Column1", Table.ColumnNames(Table.FromRecords(List.Select(Table.Column(#"Converted to Table","Column1"), each _ <> "" and _ <> null))),Table.ColumnNames(Table.FromRecords(List.Select(Table.Column(#"Converted to Table","Column1"), each _ <> "" and _ <> null)))),
    #"Changed Type" = Table.TransformColumnTypes(Result,{{"StartTime", type datetime}, {"EndTime", type datetime}, {"LogStart", type datetime}, {"LogEnd", type datetime}})
in
    #"Changed Type"

 

 

Then i am showing the data inside 2 pages, as follow:-

 

 

 

 

 

now seems the data inside the reports will not get updated unless i do a manual refresh to the data source. so how i can enable an automatic refresh to the report data? or when a user visit the reprot to get the data updated data from the API?

 

 

 

Thanks

 

 

 

 

7 Replies

  • ahadkarimi's avatar
    ahadkarimi
    Solution Specialist

    Set Up Scheduled Refresh in Power BI Service, If you have any questions or need more information, feel free to reach out to me!

     

     

  • ahadkarimi Thanks for the reply. How i can access this schdule page? i can not find it, here what i have inside the online power bi home page:-

     

     

    and inside the power bi desktop:-

     

     

     

      • mvcsharepointde's avatar
        mvcsharepointde
        Helper II

        ahadkarimi Thanks again for the reply. I published the reprot to My workspace not to power bi server.. and i share it using onedrive.. sorry i am a bit new to power BI.. so not sure if i can set a schdule for my reprot.