Forum Discussion

antonb's avatar
antonb
Frequent Visitor
9 years ago
Solved

loop through sources

Hi all,

 

I'm new to this community so I hope that i got the location right..

 

background:

I want to build someting around the webAPI's of the task tool Nozbe. You can organize your tasks in projects. I want all the tasks and all the projects so I can see the progress of tasks done. basically just because i thing this should be able with Power BI and I want to improve my Power BI skills.

 

current situation:

api for projects fills my project tables (https://webapp.nozbe.com/api/projects/)

but then I have to call the taks below based on the project ID. (https://webapp.nozbe.com/api/actions/what-project/id-????/)

I ve used the combine function to combine multiple queries (taks for project x, y, z).. but that is too fixed (I don't want to change code when I make  a new project)

 

Question:

Is it posible to use a parameter to call the taks of a project and then loop through it.

 

so in simplified code:

For each [projectid] in Projects do:

    tablewithtasks = tablewithtasks + call: https://webapp.nozbe.com/api/actions/what-project/id-[projectid]

 

Thanks in advance,

Anton

 

 

 

 


  •  It's all about getting third party data via API's


    antonb

     

    If I got your idea correctly, you could store the parameters in one column and call the API row by row. Check a simple demo below. You could check the returned json by clicking Moscow weather json.

     

    let
        Source = Table.FromRecords({  
      
        [city= "Moscow",cid=524901],  
      
        [city= "Paris",cid=2988507],  
      
        [city= "London",cid=2643743]}),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"cid", type text}}),
        #"Added Custom" = Table.AddColumn(#"Changed Type", "responseJson", each Json.Document(Web.Contents("http://api.openweathermap.org/data/2.5/forecast/city?id="&[cid]&"&APPID=76acd9a867adb4cd9120298d16b3655f")))
    in
        #"Added Custom"

4 Replies

  • Hey antonb,

     

    do you built your own Visual or you want take your third party data in Power BI?

    sry when i missunderstand your question.

     

    Nice Regards

     

    Mcburn

    • antonb's avatar
      antonb
      Frequent Visitor

      hi Mcburn,

       

      It's all about getting third party data via API's

       

       

      Thanks!

      Anton

       

      • Eric_Zhang's avatar
        Eric_Zhang
        Microsoft Employee

         It's all about getting third party data via API's


        antonb

         

        If I got your idea correctly, you could store the parameters in one column and call the API row by row. Check a simple demo below. You could check the returned json by clicking Moscow weather json.

         

        let
            Source = Table.FromRecords({  
          
            [city= "Moscow",cid=524901],  
          
            [city= "Paris",cid=2988507],  
          
            [city= "London",cid=2643743]}),
            #"Changed Type" = Table.TransformColumnTypes(Source,{{"cid", type text}}),
            #"Added Custom" = Table.AddColumn(#"Changed Type", "responseJson", each Json.Document(Web.Contents("http://api.openweathermap.org/data/2.5/forecast/city?id="&[cid]&"&APPID=76acd9a867adb4cd9120298d16b3655f")))
        in
            #"Added Custom"