<?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: How to read data from public exports api endpoint in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-read-data-from-public-exports-api-endpoint/m-p/808327#M64971</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/585167"&gt;@JSmith31&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import requests
import pandas as pd

# Set the API endpoint
endpoint = "https://api.hubspot.com/crm/v3/exports/export/async/tasks/{taskId}/status"

# Get the task ID
task_id = "1234567890"

# Make a GET request to the API endpoint
response = requests.get(endpoint, params={"taskId": task_id})

# Check the response status code
if response.status_code == 200:

    # Get the file contents
    file_contents = response.content

    # Decode the file contents
    file_contents = file_contents.decode("utf-8")

    # Create a Pandas DataFrame from the file contents
    df = pd.read_csv(file_contents)

    # Print the DataFrame
    print(df)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;This code will first set the API endpoint and get the task ID. Then, it will make a GET request to the API endpoint and check the response status code. If the response status code is 200, the code will get the file contents, decode them, and create a Pandas DataFrame from them. Finally, the code will print the DataFrame. The file contents may be encoded in a different format, such as UTF-16 or UTF-32. If this is the case, you will need to specify the correct encoding when decoding the file contents. For example, to decode the file contents as UTF-16, you would use the following code.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;file_contents = file_contents.decode("utf-16")
&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 16 Jun 2023 09:50:47 GMT</pubDate>
    <dc:creator>himanshurauthan</dc:creator>
    <dc:date>2023-06-16T09:50:47Z</dc:date>
    <item>
      <title>How to read data from public exports api endpoint</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-read-data-from-public-exports-api-endpoint/m-p/808116#M64948</link>
      <description>&lt;P&gt;I am using the HubSpot API to export a view using the &lt;A href="https://developers.hubspot.com/docs/api/crm/exports" target="_blank" rel="noopener"&gt;Export API&lt;/A&gt;. I am able to start an export by making a POST request to this endpoint '&lt;SPAN&gt;/crm/v3/exports/export/async'. From there, I want to get that data into a dataframe in python. According to the documentation, thats done by making a GET request to '/crm/v3/exports/export/async/tasks/{taskId}/status', passing in the taskid returned after starting the export.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Everything is working for me up to this point, but I am struggling to read the contents of the file. Does it need to be decoded? Are there any examples of how to do this?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 20:00:20 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/How-to-read-data-from-public-exports-api-endpoint/m-p/808116#M64948</guid>
      <dc:creator>JSmith31</dc:creator>
      <dc:date>2023-06-15T20:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to read data from public exports api endpoint</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-read-data-from-public-exports-api-endpoint/m-p/808327#M64971</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/585167"&gt;@JSmith31&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import requests
import pandas as pd

# Set the API endpoint
endpoint = "https://api.hubspot.com/crm/v3/exports/export/async/tasks/{taskId}/status"

# Get the task ID
task_id = "1234567890"

# Make a GET request to the API endpoint
response = requests.get(endpoint, params={"taskId": task_id})

# Check the response status code
if response.status_code == 200:

    # Get the file contents
    file_contents = response.content

    # Decode the file contents
    file_contents = file_contents.decode("utf-8")

    # Create a Pandas DataFrame from the file contents
    df = pd.read_csv(file_contents)

    # Print the DataFrame
    print(df)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;This code will first set the API endpoint and get the task ID. Then, it will make a GET request to the API endpoint and check the response status code. If the response status code is 200, the code will get the file contents, decode them, and create a Pandas DataFrame from them. Finally, the code will print the DataFrame. The file contents may be encoded in a different format, such as UTF-16 or UTF-32. If this is the case, you will need to specify the correct encoding when decoding the file contents. For example, to decode the file contents as UTF-16, you would use the following code.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;file_contents = file_contents.decode("utf-16")
&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 16 Jun 2023 09:50:47 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/How-to-read-data-from-public-exports-api-endpoint/m-p/808327#M64971</guid>
      <dc:creator>himanshurauthan</dc:creator>
      <dc:date>2023-06-16T09:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to read data from public exports api endpoint</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-read-data-from-public-exports-api-endpoint/m-p/808408#M64976</link>
      <description>&lt;P&gt;That does not seem to be working. When I make a GET request to that endpoint:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;https://api.hubspot.com/crm/v3/exports/export/async/tasks/{taskId}/status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;the response is just a status, and link where the file can be downloaded from. This is also confirmed in the API &lt;A href="https://developers.hubspot.com/docs/api/crm/exports" target="_blank" rel="noopener"&gt;documentation&lt;/A&gt; as the expected behavior. Here is the response :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-06-16 at 8.56.07 AM.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/93094iF5100907875E1728/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-06-16 at 8.56.07 AM.png" alt="Screenshot 2023-06-16 at 8.56.07 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, my question is then, how can I programatically use that link to retrieve the data?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 12:56:45 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/How-to-read-data-from-public-exports-api-endpoint/m-p/808408#M64976</guid>
      <dc:creator>JSmith31</dc:creator>
      <dc:date>2023-06-16T12:56:45Z</dc:date>
    </item>
  </channel>
</rss>

