<?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: Google Apps Script POST/PATCH requests giving 405/415 error? in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Google-Apps-Script-POST-PATCH-requests-giving-405-415-error/m-p/708140#M58009</link>
    <description>&lt;P&gt;Hi there, 405/415 usually means HS is rejecting the request.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could it be "content-type" instead? I personally use the nodejs library mostly, and the headers are handled by it. However I see that yours is "contentType" and maybe Google Apps translates it incorrectly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also it could be the querystring params at the back of your endpoint. Usually just stops at .../objects/companies/{companyID} and I'm not sure if this would be the case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;WL&lt;/P&gt;</description>
    <pubDate>Thu, 20 Oct 2022 07:42:59 GMT</pubDate>
    <dc:creator>weiliang_lee</dc:creator>
    <dc:date>2022-10-20T07:42:59Z</dc:date>
    <item>
      <title>Google Apps Script POST/PATCH requests giving 405/415 error?</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Google-Apps-Script-POST-PATCH-requests-giving-405-415-error/m-p/707932#M57998</link>
      <description>&lt;P&gt;Hello Hubspot community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using Google Apps Script to try and update data within my Hubspot CRM, but I'm still very much learning to work with the API. The documentation shows many examples using things like Node and Python, but Apps Script appears to use vanilla JavaScript with some custom functions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've successfully performed GET requests to pull data out of Hubspot, but now I need to learn to push data into it. The code sample I'm working on right now is intended to update a property within a company object and set it to a chosen value (in this example, the number 1000). Here's what I have so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function myFunction() {
  const ss = SpreadsheetApp.getActiveSpreadsheet();
	const ws = ss.getSheets()[0];
	const data = ws.getRange('A1').getDataRegion().getValues();
  //"?limit=10" determines how many lines of data to pull?
    //correct, and there's a limit cap of 100
  const hubSpot = "https://api.hubapi.com/crm/v3/objects/companies/************/?archived=false&amp;amp;properties=test_kpi_property;
  const testKPI = {
    "properties":{
      "test_kpi_property" : "1000"
      }
  }
  
  const options = {
    "muteHttpExceptions" : true,
    "method": "patch",    
    "headers": {
        "contentType":"application/json",
        "authorization": "Bearer ***************************************",
    },
    "payload": JSON.stringify(testKPI)
  };

  var response = UrlFetchApp.fetch(hubSpot,options);

  ws.getRange('A7').setValue(String(response));
 
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any insight here is appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 20:32:58 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Google-Apps-Script-POST-PATCH-requests-giving-405-415-error/m-p/707932#M57998</guid>
      <dc:creator>zachh</dc:creator>
      <dc:date>2022-10-19T20:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Google Apps Script POST/PATCH requests giving 405/415 error?</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Google-Apps-Script-POST-PATCH-requests-giving-405-415-error/m-p/708140#M58009</link>
      <description>&lt;P&gt;Hi there, 405/415 usually means HS is rejecting the request.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could it be "content-type" instead? I personally use the nodejs library mostly, and the headers are handled by it. However I see that yours is "contentType" and maybe Google Apps translates it incorrectly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also it could be the querystring params at the back of your endpoint. Usually just stops at .../objects/companies/{companyID} and I'm not sure if this would be the case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;WL&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 07:42:59 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Google-Apps-Script-POST-PATCH-requests-giving-405-415-error/m-p/708140#M58009</guid>
      <dc:creator>weiliang_lee</dc:creator>
      <dc:date>2022-10-20T07:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Google Apps Script POST/PATCH requests giving 405/415 error?</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Google-Apps-Script-POST-PATCH-requests-giving-405-415-error/m-p/708262#M58017</link>
      <description>&lt;P&gt;OMG that was it. The contentType is how Apps Script formats it, but I'm including it in the header so it makes sense that it needs to be formatted for Hubspot. Thank you so much!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 12:15:46 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Google-Apps-Script-POST-PATCH-requests-giving-405-415-error/m-p/708262#M58017</guid>
      <dc:creator>zachh</dc:creator>
      <dc:date>2022-10-20T12:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: Google Apps Script POST/PATCH requests giving 405/415 error?</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Google-Apps-Script-POST-PATCH-requests-giving-405-415-error/m-p/708662#M58043</link>
      <description>&lt;P&gt;Glad it worked!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;WL&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 02:08:03 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Google-Apps-Script-POST-PATCH-requests-giving-405-415-error/m-p/708662#M58043</guid>
      <dc:creator>weiliang_lee</dc:creator>
      <dc:date>2022-10-21T02:08:03Z</dc:date>
    </item>
  </channel>
</rss>

