<?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: Error while using custom code to update task in Data Hub</title>
    <link>https://community.hubspot.com/t5/Data-Hub/Error-while-using-custom-code-to-update-task/m-p/677783#M974</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/423945"&gt;@AbdulRahim&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems as if you are trying to pass an API key in the authorization header, which will not work.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://developers.hubspot.com/changelog/upcoming-api-key-sunset" target="_blank" rel="noopener"&gt;API keys are getting sunset&lt;/A&gt;, so your go-to authentication method should be a &lt;A href="https://developers.hubspot.com/docs/api/migrate-an-api-key-integration-to-a-private-app" target="_blank" rel="noopener"&gt;private app&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm pretty positive that if you use a private app token in your code instead of the API key, it should work. Just make sure you have the right scope selected.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Aug 2022 11:09:02 GMT</pubDate>
    <dc:creator>Teun</dc:creator>
    <dc:date>2022-08-09T11:09:02Z</dc:date>
    <item>
      <title>Error while using custom code to update task</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Error-while-using-custom-code-to-update-task/m-p/676773#M971</link>
      <description>&lt;P&gt;I am trying to update tasks using Python 3.9 for learning purposes.&lt;/P&gt;&lt;P&gt;I tried several ways to resolve this error but the error persists.&lt;/P&gt;&lt;P&gt;The error:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ERROR] ApiException: (401)
Reason: Unauthorized
HTTP response body: {"status":"error","message":"Authentication credentials not found."}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;        url = 'https://api.hubapi.com/crm/v3/objects/tasks/' + task.id
        auth = os.getenv('HAPIKEY')
        payload = "{\"properties\":{\"hs_task_status\":\"COMPLETED\"}}"
        headers = {
            'accept': 'application/json',
            'content-type': 'application/json',
            'authorization': 'Bearer '+auth
            }
        response = requests.request(
            "PATCH", url, data=payload, headers=headers)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Aug 2022 16:27:43 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Error-while-using-custom-code-to-update-task/m-p/676773#M971</guid>
      <dc:creator>AbdulRahim</dc:creator>
      <dc:date>2022-08-06T16:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Error while using custom code to update task</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Error-while-using-custom-code-to-update-task/m-p/677783#M974</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/423945"&gt;@AbdulRahim&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems as if you are trying to pass an API key in the authorization header, which will not work.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://developers.hubspot.com/changelog/upcoming-api-key-sunset" target="_blank" rel="noopener"&gt;API keys are getting sunset&lt;/A&gt;, so your go-to authentication method should be a &lt;A href="https://developers.hubspot.com/docs/api/migrate-an-api-key-integration-to-a-private-app" target="_blank" rel="noopener"&gt;private app&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm pretty positive that if you use a private app token in your code instead of the API key, it should work. Just make sure you have the right scope selected.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2022 11:09:02 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Error-while-using-custom-code-to-update-task/m-p/677783#M974</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2022-08-09T11:09:02Z</dc:date>
    </item>
  </channel>
</rss>

