<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: API Query iteration in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/API-Query-iteration/m-p/3699985#M49541</link>
    <description>&lt;P&gt;Use List.Generate or simply {30..32}&amp;nbsp; to feed your API URL.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Feb 2024 01:51:13 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2024-02-15T01:51:13Z</dc:date>
    <item>
      <title>API Query iteration</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-Query-iteration/m-p/3697539#M49523</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I am hitting an API from PowerBi that does not offer a range option.&amp;nbsp; So I am stuck doing multiple queries to get a complete dataset.&amp;nbsp;&amp;nbsp;Output is JSON.&lt;/P&gt;&lt;P&gt;For some random API:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.someapiurl.com/&amp;amp;parameter1=A&amp;amp;parameter2=B&amp;amp;parameter3=C" target="_blank" rel="noopener"&gt;www.someapiurl.com/&amp;amp;parameter1=A&amp;amp;parameter2=30&amp;amp;parameter3=C&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Return all columns' data for parameter2 = 30 AND 31 AND 32, etc.&lt;/P&gt;&lt;P&gt;In other words, iterate thru values 30-32 for parameter2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected output:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Column1&lt;/TD&gt;&lt;TD&gt;Column2&lt;/TD&gt;&lt;TD&gt;Column3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;value when parameter2=30&lt;/TD&gt;&lt;TD&gt;value when parameter2=30&lt;/TD&gt;&lt;TD&gt;value when parameter2=30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;value when parameter2=31&lt;/TD&gt;&lt;TD&gt;value when parameter2=31&lt;/TD&gt;&lt;TD&gt;value when parameter2=31&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;value when parameter2=32&lt;/TD&gt;&lt;TD&gt;value when parameter2=32&lt;/TD&gt;&lt;TD&gt;value when parameter2=32&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to do this?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 01:00:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-Query-iteration/m-p/3697539#M49523</guid>
      <dc:creator>hxnwx</dc:creator>
      <dc:date>2024-02-14T01:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: API Query iteration</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-Query-iteration/m-p/3699985#M49541</link>
      <description>&lt;P&gt;Use List.Generate or simply {30..32}&amp;nbsp; to feed your API URL.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 01:51:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-Query-iteration/m-p/3699985#M49541</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-02-15T01:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: API Query iteration</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-Query-iteration/m-p/3699993#M49542</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/183469"&gt;@hxnwx&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I'd like to suggest you create a query table with parameter value list as @lbendlin mentioned, then you can add a new column with web connector to invoke api with current row field values as parameters.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;    AddColumn = Table.AddColumn(
        #"Previous Step",
        "NewTable",
        each
            Web.Contents(
                "www.someapiurl.com/",
                [
                    Headers = [
                        #"Authorization" = "Bearer " &amp;amp; "token strings",
                        #"Content-Type" = "application/json"
                    ],
                    Query = [
                        parameter1 = [ColumnA],
                        parameter2 = [ColumnB],
                        parameter3 = [ColumnC]
                    ]
                ]
            )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;A href="https://blog.crossjoin.co.uk/2016/08/16/using-the-relativepath-and-query-options-with-web-contents-in-power-query-and-power-bi-m-code/" target="_blank"&gt;Chris Webb's BI Blog: Using The RelativePath And Query Options With Web.Contents() In Power Query And Power BI M Code (crossjoin.co.uk)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 01:58:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-Query-iteration/m-p/3699993#M49542</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-15T01:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: API Query iteration</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-Query-iteration/m-p/3705510#M49597</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;SPAN&gt;Xiaoxin.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I went in a slightly different direction, using List.Accumulate which gave me a list of binary from passing in only one parameter for Query argument. I and was able to get the data in the form I need.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My question now is, how can I pass in a table (3 columns) of values for list in List.Accumulate so it can iterate over all combinations of all parameters?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ex.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Table:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ColumnA&lt;/TD&gt;&lt;TD&gt;ColumnB&lt;/TD&gt;&lt;TD&gt;ColumnC&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;parameter1value1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;parameter2value1&lt;/TD&gt;&lt;TD&gt;parameter3value1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;parameter1value2&lt;/TD&gt;&lt;TD&gt;parameter2value2&lt;/TD&gt;&lt;TD&gt;parameter3value2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;parameter1value3&lt;/TD&gt;&lt;TD&gt;parameter2value3&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;parameter1value4&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So my WebQuery would start with Column A's parameter1value1, then iterate thru ALL values of ColumnB&amp;nbsp; for parameter2, then all values of ColumnC for parameter3.&amp;nbsp; Then move to parameter1value2 and repeat process until end of ColumnA.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
   GetWebData = (statisticType as text) =&amp;gt;
       let
           Source = 
            Web.Contents("https://someapiurl?TIME=parameter1&amp;amp;POLYGON=parameter2&amp;amp;STATISTICS=parameter3", 
                [
                    Query=
                        [
                            STATISTICS=statisticType
                        ]
               
               ]
            )
       in
           Source            
in
   GetWebData


let
   YourList = {parameter3value1, parameter3value2, parameter3value3},
   Result = List.Accumulate(YourList, {}, (state, current) =&amp;gt; state &amp;amp; {WebQuery(Text.From(current))}),
in
	Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Feb 2024 22:23:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-Query-iteration/m-p/3705510#M49597</guid>
      <dc:creator>hxnwx</dc:creator>
      <dc:date>2024-02-17T22:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: API Query iteration</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-Query-iteration/m-p/3705517#M49598</link>
      <description>&lt;P&gt;List.Accumulate is not a good idea as it forces you to lug all the data around with you - multiple times. And no, a recursive function is not good either, for the same reasons.&lt;/P&gt;</description>
      <pubDate>Sat, 17 Feb 2024 22:34:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-Query-iteration/m-p/3705517#M49598</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-02-17T22:34:07Z</dc:date>
    </item>
  </channel>
</rss>

