Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Parameters for JSON API data - Maintain Query daily

How can I maintain a report from a JSON API service when the JSON URL I am using is parameterized and needs to be updated to retrieve new data.   The current working URL I have is Source =...
  • Anonymous's avatar
    Anonymous
    9 years ago

    Hi Anonymous,

    Add a new blank query in Power BI Desktop, then paste  the following code in Advanced Editor.

    let sqltext = (Date as text) =>
    
    let
        Source = Json.Document((Web.Contents("https://api.tatts.com/sales/vmax/web/data/racing/" & Date & "/sr/full")))
    in
        Source  
    in
        sqltext
    


    Then you can input date in the sqltext function to return result of that date. See my example below.


    Thanks,
    Lydia Zhang