title: Building URL from first query to make URL for addl columsn and details. excel / powerquery
body: <p>I am trying to figure out how to add extended details generate from my first Json.Document Web.Contents query. Each record returns some variables that are used to generate a URL where I can query addition details for the items in each row. I think I have to make a function, but cannot figure out how to get this done for each row.</p>
  <p>I've gotten the first query put together, and after a bit I figured out how to generate the URL needed for the extra information.</p>
  <pre><code>let
      url = &quot;https://inventoryservice.website.com/Inventory/Search&quot;,
      body = 
        &quot;{
          &quot;&quot;Locations&quot;&quot;:[14,12,15,16,22],
          &quot;&quot;Models&quot;&quot;:[99],
          &quot;&quot;ID&quot;&quot;:13,
          &quot;&quot;Years&quot;&quot;:[2020,2021]
        }&quot;,
      Headers = [
          #&quot;Authority&quot;=&quot;inventoryservice.website.com&quot;,
          #&quot;Method&quot;=&quot;POST&quot;,
          #&quot;Accept&quot;=&quot;*/*&quot;,
          #&quot;Origin&quot;=&quot;https://www.website.com&quot;,
          #&quot;Referer&quot;=&quot;https://www.website.com/&quot;,
          #&quot;Content-Type&quot;=&quot;application/json; charset=utf-8&quot;,
          #&quot;User-Agent&quot;=&quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0&quot;
          ],
      Source = Json.Document(Web.Contents(url,[Headers = Headers,Content = Text.ToBinary(body)])),
  
      #&quot;Converted to Table&quot; = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
      #&quot;Expanded Column1&quot; = Table.ExpandRecordColumn(#&quot;Converted to Table&quot;, &quot;Column1&quot;, {&quot;exact&quot;}, {&quot;Column1.exact&quot;}),
      #&quot;Expanded Column1.exact&quot; = Table.ExpandListColumn(#&quot;Expanded Column1&quot;, &quot;Column1.exact&quot;),
      #&quot;Expanded Column1.exact1&quot; = Table.ExpandRecordColumn(#&quot;Expanded Column1.exact&quot;, &quot;Column1.exact&quot;, {&quot;longID&quot;, &quot;ticketID&quot;, &quot;lineID&quot;, &quot;locID&quot;, &quot;locName&quot;, &quot;makeName&quot;, &quot;modelName&quot;, &quot;modelYear&quot;, &quot;serial&quot;, &quot;dateAdded&quot;}),
      #&quot;Changed Type&quot; = Table.TransformColumnTypes(#&quot;Expanded Column1.exact1&quot;,{{&quot;longID&quot;, Int64.Type}, {&quot;ticketID&quot;, Int64.Type}, {&quot;lineID&quot;, Int64.Type}, {&quot;locID&quot;, Int64.Type}, {&quot;locName&quot;, type text}, {&quot;makeName&quot;, type text}, {&quot;modelName&quot;, type text}, {&quot;modelYear&quot;, Int64.Type},  {&quot;serial&quot;, type text}, {&quot;dateAdded&quot;, type datetime}}),
  
      /*BUILD URL COLUMN*/
      infoUrl = each &quot;https://inventoryservice.website.com/InventoryExtendedInfo/&quot; &amp; Number.ToText([locID]) &amp; &quot;/&quot; &amp; Number.ToText([ticketID]) &amp; &quot;/&quot; &amp; Number.ToText([lineID]) &amp; &quot;/&quot;,
      #&quot;Added Custom&quot; = Table.AddColumn(#&quot;Changed Type&quot;, &quot;Custom&quot;, infoUrl)
  in
      #&quot;Added Custom&quot;
  </code></pre>
  <p>For additional details I can hard code the url and make a a one row table with the following, but I cannot figure out how to add the additional columns to the original matching record on the table.</p>
  <pre><code>let
      url = &quot;https://inventoryservice.website.com/ExtendedInfo/14/1080204/1/&quot;,
      Source = Json.Document(Web.Contents(
          url,[ 
          Headers = [
              #&quot;Authority&quot;=&quot;inventoryservice.website.com&quot;,
              #&quot;Method&quot;=&quot;POST&quot;,
              #&quot;Accept&quot;=&quot;*/*&quot;,
              #&quot;Origin&quot;=&quot;https://www.website.com&quot;,
              #&quot;Referer&quot;=&quot;https://www.website.com/&quot;,
              #&quot;Content-Type&quot;=&quot;application/json; charset=utf-8&quot;,
              #&quot;User-Agent&quot;=&quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0&quot;
              ]
          ]
      )),
      #&quot;Converted to Table&quot; = Record.ToTable(Source),
      #&quot;Transposed Table&quot; = Table.Transpose(#&quot;Converted to Table&quot;),
      #&quot;Promoted Headers&quot; = Table.PromoteHeaders(#&quot;Transposed Table&quot;, [PromoteAllScalars=true]),
      #&quot;Changed Type&quot; = Table.TransformColumnTypes(#&quot;Promoted Headers&quot;,{{&quot;Type&quot;, type text}, {&quot;SubType&quot;, type any}, {&quot;style&quot;, type text}, {&quot;color&quot;, type text}})
  in
      #&quot;Changed Type&quot;
  </code></pre>