<?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 Getting data from XML API fails in copy data but works in web activity in Pipelines</title>
    <link>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4371523#M6893</link>
    <description>&lt;P&gt;I am trying to get the data from an XML based API into a datalake. Using web activities I succeeded retrieving the data, but I couldn't find a way to load that output into a datalake. I tried the copy data with a rest connection as source, this resulted in a 500 error. Most of the solutions I could find were options I don't see in my UI (I will attach some screenshots).&lt;BR /&gt;The most important thing is just to get the data in datalake. It doesn't matter what activities I use. If possible, I like to use the output of a web activity (which like I mentioned does retrieve data).&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jan 2025 09:27:35 GMT</pubDate>
    <dc:creator>Jorn_vb</dc:creator>
    <dc:date>2025-01-20T09:27:35Z</dc:date>
    <item>
      <title>Getting data from XML API fails in copy data but works in web activity</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4371523#M6893</link>
      <description>&lt;P&gt;I am trying to get the data from an XML based API into a datalake. Using web activities I succeeded retrieving the data, but I couldn't find a way to load that output into a datalake. I tried the copy data with a rest connection as source, this resulted in a 500 error. Most of the solutions I could find were options I don't see in my UI (I will attach some screenshots).&lt;BR /&gt;The most important thing is just to get the data in datalake. It doesn't matter what activities I use. If possible, I like to use the output of a web activity (which like I mentioned does retrieve data).&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2025 09:27:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4371523#M6893</guid>
      <dc:creator>Jorn_vb</dc:creator>
      <dc:date>2025-01-20T09:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Getting data from XML API fails in copy data but works in web activity</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4371912#M6894</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="915531" data-lia-user-login="Jorn_vb" class="lia-mention lia-mention-user"&gt;Jorn_vb&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To retrieve XML data from an API and load it into a Microsoft Fabric Lakehouse, you can use a combination of Web Activity and Copy Activity in your data pipeline. Here's a step-by-step approach to accomplish this:&lt;/SPAN&gt;&lt;/P&gt;&lt;H2&gt;Use Web Activity to Retrieve XML Data&lt;/H2&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;Add a Web Activity to your pipeline to make the API call and retrieve the XML data.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Configure the Web Activity with the appropriate URL, method, headers, and any required authentication.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;The Web Activity will successfully retrieve the XML data as you've mentioned.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;H2&gt;Process Web Activity Output&lt;/H2&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;Add a Set Variable Activity after the Web Activity.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Configure the Set Variable Activity to store the Web Activity's output in a variable.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Use the following expression to capture the Web Activity's output:&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;@activity('Web1').output.Response&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;(Replace 'Web1' with your Web Activity's name)&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;H2&gt;Use Copy Activity to Load Data into Lakehouse&lt;/H2&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;Add a Copy Activity after the Set Variable Activity.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;For the source:&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;Choose "REST" as the source type.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Set the Request Method to "GET".&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;In the Additional Headers, add a Content-Type header with value "application/xml".&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;In the Request Body, use the variable you set in the previous step.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;For the sink:&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;Choose your Lakehouse as the destination.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Select the appropriate file format (e.g., XML, JSON, or Parquet, depending on your needs).&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;In the Copy Activity's settings, enable "First row as header" if applicable.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;EM&gt;Please accept this solution and give kudos , if this helps .&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2025 13:15:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4371912#M6894</guid>
      <dc:creator>nilendraFabric</dc:creator>
      <dc:date>2025-01-20T13:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: Getting data from XML API fails in copy data but works in web activity</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4388806#M6974</link>
      <description>&lt;P&gt;Can you explain:&amp;nbsp;&lt;SPAN&gt;Choose "REST" as the source type. How can I set the Request body for a GET request? It only shows up for me when I switch it to POST?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2025 20:17:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4388806#M6974</guid>
      <dc:creator>Salmatador</dc:creator>
      <dc:date>2025-01-30T20:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Getting data from XML API fails in copy data but works in web activity</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4388827#M6975</link>
      <description>&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-factory/connector-rest-copy-activity" target="_blank"&gt;https://learn.microsoft.com/en-us/fabric/data-factory/connector-rest-copy-activity&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2025 20:37:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4388827#M6975</guid>
      <dc:creator>nilendraFabric</dc:creator>
      <dc:date>2025-01-30T20:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Getting data from XML API fails in copy data but works in web activity</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4389925#M6979</link>
      <description>&lt;P&gt;The screenshots on this page do not look like my UI (see screenshot in my post). With what I know it does not make sense to put the response (data I want) into the body of a request? But that is probaply just because what I see mismatches what you see. Do you know anything that can help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2025 13:02:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4389925#M6979</guid>
      <dc:creator>Jorn_vb</dc:creator>
      <dc:date>2025-01-31T13:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Getting data from XML API fails in copy data but works in web activity</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4390416#M6980</link>
      <description>&lt;P&gt;The screen shots do not match what I see either and I was at a loss on how to create a dummy request, I am new to this. I ended up using a notebook with the requests and pandas libraries to import the xml API data into my lakehouse tables&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2025 18:31:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4390416#M6980</guid>
      <dc:creator>Salmatador</dc:creator>
      <dc:date>2025-01-31T18:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Getting data from XML API fails in copy data but works in web activity</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4390425#M6981</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="643353" data-lia-user-login="Salmatador" class="lia-mention lia-mention-user"&gt;Salmatador&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please share your approach here.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2025 18:38:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4390425#M6981</guid>
      <dc:creator>nilendraFabric</dc:creator>
      <dc:date>2025-01-31T18:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: Getting data from XML API fails in copy data but works in web activity</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4390445#M6982</link>
      <description>&lt;P&gt;Here is what I did to test that I could get it to work.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from io import StringIO # https://docs.python.org/3/library/io.html#io.StringIO
import pandas as pd # https://pandas.pydata.org/docs/reference/index.html
import requests # https://requests.readthedocs.io/en/latest/

# Setup Request Variables.

base_url = 'https://vsac.nlm.nih.gov/vsac/svs/'
end_point = 'RetrieveMultipleValueSets'
parameters = {'id':'2.16.840.1.113883.3.117.1.7.1.226','release':'eCQM Update 2020-05-07'}

# Request - Basic Authentication values have been removed 

response = requests.get(f"{base_url}{end_point}",params=parameters,auth=('userName','password'))

# Warns about using response.text directly using StringIO as suggested 
xml_io_concept = StringIO(response.text)

# Define namespaces
namespaces = {
    'ns0': 'urn:ihe:iti:svs:2008',
    'xsi': 'http://www.w3.org/2001/XMLSchema-instance'
}

# Parse the XML and extract Concept elements
pandas_df = pd.read_xml( # https://pandas.pydata.org/docs/reference/api/pandas.read_xml.html
    xml_io_concept,
    xpath=".//ns0:Concept",
    namespaces=namespaces
)

# Convert Pandas to PySpark 

spark_df = spark.createDataFrame(pandas_df)

# Write to table in default Lakehouse 

spark_df.write.format("delta").mode("overwrite").option("overwriteSchema", "true").save(f"Tables/test_value_set")

# Query Lakehouse Table

df = spark.sql("SELECT * FROM ValueSet_Lake.test_value_set LIMIT 1000")
display(df)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2025 19:04:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4390445#M6982</guid>
      <dc:creator>Salmatador</dc:creator>
      <dc:date>2025-01-31T19:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Getting data from XML API fails in copy data but works in web activity</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4390461#M6986</link>
      <description>&lt;P&gt;Thanks for sharing&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="643353" data-lia-user-login="Salmatador" class="lia-mention lia-mention-user"&gt;Salmatador&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="915531" data-lia-user-login="Jorn_vb" class="lia-mention lia-mention-user"&gt;Jorn_vb&lt;/a&gt;&amp;nbsp;see if this is helpful&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2025 19:40:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4390461#M6986</guid>
      <dc:creator>nilendraFabric</dc:creator>
      <dc:date>2025-01-31T19:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Getting data from XML API fails in copy data but works in web activity</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4397881#M7019</link>
      <description>&lt;P&gt;I solved the copy data by using a http connector with basic auth instead of a REST connection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This was not obvious because the API uses tokens for auth and a http connection anomynous failed.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 09:08:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Getting-data-from-XML-API-fails-in-copy-data-but-works-in-web/m-p/4397881#M7019</guid>
      <dc:creator>Jorn_vb</dc:creator>
      <dc:date>2025-02-06T09:08:39Z</dc:date>
    </item>
  </channel>
</rss>

