<?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 FileUpload Example Postman in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/FileUpload-Example-Postman/m-p/1055233#M77404</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;can anyone please provide a working example for a file upload. Trying few things but ending at the moment with error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="OliSteini_0-1729000307277.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/129341i7E67AEC418AA67E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="OliSteini_0-1729000307277.png" alt="OliSteini_0-1729000307277.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Oct 2024 13:52:46 GMT</pubDate>
    <dc:creator>OliSteini</dc:creator>
    <dc:date>2024-10-15T13:52:46Z</dc:date>
    <item>
      <title>FileUpload Example Postman</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/FileUpload-Example-Postman/m-p/1055233#M77404</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;can anyone please provide a working example for a file upload. Trying few things but ending at the moment with error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="OliSteini_0-1729000307277.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/129341i7E67AEC418AA67E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="OliSteini_0-1729000307277.png" alt="OliSteini_0-1729000307277.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 13:52:46 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/FileUpload-Example-Postman/m-p/1055233#M77404</guid>
      <dc:creator>OliSteini</dc:creator>
      <dc:date>2024-10-15T13:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: FileUpload Example Postman</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/FileUpload-Example-Postman/m-p/1055287#M77408</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/842061"&gt;@OliSteini&lt;/a&gt;&amp;nbsp;- I've worked with this a number of time and I agree the documentation and examples are a bit underwhelming.&lt;/P&gt;
&lt;P&gt;My approch has ended up being around getting the file data into an array format and then using that as the file parameter to the HubSpot API call. This is sensetive to the encoding used and it also seems necessary to be very careful constructing the header for the request.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;    # try this as a string input to files API call
    upload_url = "https://api.hubapi.com/filemanager/api/v3/files/upload"
    folder_name ="/test"
    file_options = {
      'ttl' : None,
      'access': 'PUBLIC_NOT_INDEXABLE',
      'overwrite': True,
      'duplicateValidationStrategy': 'NONE',
      'duplicateValidationScope': 'EXACT_FOLDER'
    }
    files_data = {
      'fileName' : file_name,
      'folderPath' : folder_name,
      'file': file_string,
      'options': json.dumps(file_options)
    }
    file_headers = {
      'Authorization': 'Bearer ' + appToken
    }
  
    #note special request headers required for file API payload encoding
    response = requests.post(upload_url, files=files_data, headers=file_headers)
    print("Doc upload response: ", response.status_code)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this is helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 15:04:51 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/FileUpload-Example-Postman/m-p/1055287#M77408</guid>
      <dc:creator>SteveHTM</dc:creator>
      <dc:date>2024-10-15T15:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: FileUpload Example Postman</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/FileUpload-Example-Postman/m-p/1060494#M77681</link>
      <description>&lt;P&gt;try again hopefully it will soved.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2024 13:28:12 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/FileUpload-Example-Postman/m-p/1060494#M77681</guid>
      <dc:creator>AJoseph61</dc:creator>
      <dc:date>2024-10-25T13:28:12Z</dc:date>
    </item>
  </channel>
</rss>

