<?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 API Domain in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/API-Domain/m-p/856262#M67780</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hello Guys ,&lt;BR /&gt;&lt;BR /&gt;I got a small tweak on my code below image ., Can you give me idea how to make the domain from the API call to be dynamic. Because we plan to install the theme to another account. right now the domain is static e.g "transforminator.com" if we installed it to the different domain it simply dont work the code&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jun22_0-1695835343945.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/99974i558EFBB0C2AC19F0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jun22_0-1695835343945.png" alt="Jun22_0-1695835343945.png" /&gt;&lt;/span&gt;.. If the other account using domain e.g "testdomain.com"&amp;nbsp; it should be generate the domain to that so the js code will work.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Hope someone can give me some light on this one &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ScreenShot Tool -20230928011540.png" style="width: 999px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/99975i272890759E83AC82/image-size/large?v=v2&amp;amp;px=999" role="button" title="ScreenShot Tool -20230928011540.png" alt="ScreenShot Tool -20230928011540.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Sep 2023 17:24:51 GMT</pubDate>
    <dc:creator>Jun22</dc:creator>
    <dc:date>2023-09-27T17:24:51Z</dc:date>
    <item>
      <title>API Domain</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/API-Domain/m-p/856262#M67780</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello Guys ,&lt;BR /&gt;&lt;BR /&gt;I got a small tweak on my code below image ., Can you give me idea how to make the domain from the API call to be dynamic. Because we plan to install the theme to another account. right now the domain is static e.g "transforminator.com" if we installed it to the different domain it simply dont work the code&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jun22_0-1695835343945.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/99974i558EFBB0C2AC19F0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jun22_0-1695835343945.png" alt="Jun22_0-1695835343945.png" /&gt;&lt;/span&gt;.. If the other account using domain e.g "testdomain.com"&amp;nbsp; it should be generate the domain to that so the js code will work.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Hope someone can give me some light on this one &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ScreenShot Tool -20230928011540.png" style="width: 999px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/99975i272890759E83AC82/image-size/large?v=v2&amp;amp;px=999" role="button" title="ScreenShot Tool -20230928011540.png" alt="ScreenShot Tool -20230928011540.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 17:24:51 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/API-Domain/m-p/856262#M67780</guid>
      <dc:creator>Jun22</dc:creator>
      <dc:date>2023-09-27T17:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: API Domain</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/API-Domain/m-p/856433#M67799</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/126836"&gt;@Jun22&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HubSpot has a number of &lt;A href="https://developers.hubspot.com/docs/cms/hubl/variables" target="_blank" rel="noopener"&gt;variables available&lt;/A&gt; in diffrent places (e.g. templates, modules, emails, etc.). Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;var company_domain = "{{ company_domain }}";&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have fun&lt;/P&gt;
&lt;P&gt;Mike&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="font-size: 0.8rem;"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Mike Eastwood" style="width: 80px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/99912i570A597AF087E727/image-size/small?v=v2&amp;amp;px=200" role="button" title="Mike-Eastwood-Webalite-800x800px-20230811.jpg" alt="Mike Eastwood" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Mike Eastwood&lt;/span&gt;&lt;/span&gt;Here to learn more about HubSpot and share my HubSpot Knowledge. I'm the founder of &lt;A href="https://www.webalite.com?utm_campaign=community-forum&amp;amp;utm_source=community&amp;amp;utm_content=signature" target="_blank"&gt;Webalite&lt;/A&gt; a HubSpot Partner Agency based in Wellington, New Zealand and the founder of &lt;STRONG&gt;Portal-iQ&lt;/STRONG&gt; the world's first automated &lt;A href="https://portal-iq.com?utm_campaign=community-forum&amp;amp;utm_source=community-forum&amp;amp;utm_content=signature" target="_blank"&gt;HubSpot Portal Audit&lt;/A&gt; that helps you work smarter with HubSpot.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 22:56:49 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/API-Domain/m-p/856433#M67799</guid>
      <dc:creator>Mike_Eastwood</dc:creator>
      <dc:date>2023-09-27T22:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: API Domain</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/API-Domain/m-p/856609#M67806</link>
      <description>&lt;P&gt;Hello sir, New to this,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;How do i placed that variable into the code I tried this one below but didn't work&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Require axios library to make API requests
const axios = require("axios");
var company_domain = "{{company_domain}}";
// This function is executed when a request is made to the endpoint associated with this file in the serverless.json file
exports.main = async (context, sendResponse) =&amp;gt; {
// Use axios to make a GET request to the search API
const config = {
method: "get",
url: `https://api.hubapi.com/crm/v3/objects/contacts/${context.contact.vid}/associations/deals`,
headers: {
Authorization: "Bearer pat-na1-1d1c158f-6f71-4669-b3e9-0d0fa47b89b2",
},
};

try {
const deals = [];
const { data: dealIds } = await axios(config);
for await (const dealId of dealIds.results) {
const { data: deal } = await axios.get(
`{company_domain}/_hcms/api/congratsdeal_new?id=${dealId.id}`
);
deals.push(deal);
}
console.log(company_domain)
sendResponse({ statusCode: 200, body: JSON.stringify(deals) });
} catch (error) {
sendResponse({ statusCode: 400, body: JSON.stringify(error) });
}
};
&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 28 Sep 2023 10:04:13 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/API-Domain/m-p/856609#M67806</guid>
      <dc:creator>Jun22</dc:creator>
      <dc:date>2023-09-28T10:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: API Domain</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/API-Domain/m-p/857041#M67830</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/126836"&gt;@Jun22&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are using a Serverless Function you don't need to specify the domain name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This article was helpful for me:&amp;nbsp;&lt;A href="https://developers.hubspot.com/docs/cms/data/serverless-functions" target="_blank"&gt;https://developers.hubspot.com/docs/cms/data/serverless-functions&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mike&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 23:10:56 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/API-Domain/m-p/857041#M67830</guid>
      <dc:creator>Mike_Eastwood</dc:creator>
      <dc:date>2023-09-28T23:10:56Z</dc:date>
    </item>
  </channel>
</rss>

