Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Looping through Parameters for API calling

Hello, 

 

I am trying to call weather API data for specific locations but cannot find a way to perforom multiple calls for a single query. I would like for my query to step (loop) through the data and return a full response. 

 

1. I begin with my name and location data. Aiport IATA codes and Lat/Long coordinates (both text)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2. I then create a parameter for the custom URL/API query. I've tried using the 'suggested values' option as query, but hit the same issue with BI only referencing one value in a query.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3. Query from web with custom URL, at this point I would like my parameter to Loop through the many values of the Coordinates I had inputted as list. 

 

 

 

 

 

 

 

 

 

 

At this point I recieve a table with appropriate data for One location, this table updates ifI  I change the value of my parameter, but my intention is to call all the locations. 

 

Any help would be great. I have already looked into some M-query possabilities. However, if i can fix this within BI it would easier. 

 

  • Hi Anonymous,

     

    That's because the return type of Web and Json are different. You can't replace the function directly. I would suggest you create a single query and copy the code to the function [url]. Please refer to the snapshot below.

    Looping-through-Parameters-for-API-calling3

     

    Best Regards,
    Dale

  • Anonymous's avatar
    Anonymous
    7 years ago

     

    Literally overcomplicated it, this function once invoked will return a record of data for every URL in the Loop, storing them in the custom column. Posting for future solutions. v-jiascu-msft thank you again Sir for your time and help!

11 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      hello v-jiascu-msft

       

      I think that is the right track for sure, I am pulling a JSON object so the code reflects the following 

       

       

       

      I then create a custom column by invoking the above function.  

       

       

      However, once I try to call the data from the API i'm given a column of errors with the following: 

       

       

      Is there a way to trouble-shoot around this, it is defiently reaching and calling from the API. I'm worried that BI cannot interpret the data. Thank you again for your help. 

      • v-jiascu-msft's avatar
        v-jiascu-msft
        Microsoft Employee

        Hi Anonymous,

         

        That's because the return type of Web and Json are different. You can't replace the function directly. I would suggest you create a single query and copy the code to the function [url]. Please refer to the snapshot below.

        Looping-through-Parameters-for-API-calling3

         

        Best Regards,
        Dale

  • Anonymous's avatar
    Anonymous
    Not applicable

    Did not load on orignal post (API query)