<?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: Creating associations in hubspot-api-nodejs new version in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Creating-associations-in-hubspot-api-nodejs-new-version/m-p/803480#M64643</link>
    <description>&lt;P&gt;Hey himanshurauthan! Thank you for the quick answer!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I tried your code here, and it's giving me this warning/error:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SnippingTool_IAupqQupIw.png" style="width: 999px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/92320iBA8747734F6CFA5B/image-size/large?v=v2&amp;amp;px=999" role="button" title="SnippingTool_IAupqQupIw.png" alt="SnippingTool_IAupqQupIw.png" /&gt;&lt;/span&gt;&lt;BR /&gt;As I said in my original question, the create of this version it's different.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;export declare class PromiseDefinitionsApi {
    private api;
    constructor(configuration: Configuration, requestFactory?: DefinitionsApiRequestFactory, responseProcessor?: DefinitionsApiResponseProcessor);
    archive(fromObjectType: string, toObjectType: string, associationTypeId: number, _options?: Configuration): Promise&amp;lt;void&amp;gt;;
    create(fromObjectType: string, toObjectType: string, publicAssociationDefinitionCreateRequest: PublicAssociationDefinitionCreateRequest, _options?: Configuration): Promise&amp;lt;CollectionResponseAssociationSpecWithLabelNoPaging&amp;gt;;
    getAll(fromObjectType: string, toObjectType: string, _options?: Configuration): Promise&amp;lt;CollectionResponseAssociationSpecWithLabelNoPaging&amp;gt;;
    update(fromObjectType: string, toObjectType: string, publicAssociationDefinitionUpdateRequest: PublicAssociationDefinitionUpdateRequest, _options?: Configuration): Promise&amp;lt;void&amp;gt;;
}&lt;/LI-CODE&gt;&lt;P&gt;The create receives 4 parameters&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jun 2023 12:43:48 GMT</pubDate>
    <dc:creator>gangelo</dc:creator>
    <dc:date>2023-06-06T12:43:48Z</dc:date>
    <item>
      <title>Creating associations in hubspot-api-nodejs new version</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Creating-associations-in-hubspot-api-nodejs-new-version/m-p/803292#M64624</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi everyone! I'm using the nodejs-api for the first time, but I was reading the documentation, and the readme still needed to be updated.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;This readme (&lt;/SPAN&gt;&lt;A class="" href="https://github.com/HubSpot/hubspot-api-nodejs#example-create-contact-company-and-associate-created-objects" target="_blank" rel="noopener noreferrer"&gt;https://github.com/HubSpot/hubspot-api-nodejs#example-create-contact-company-and-associate-created-objects&lt;/A&gt;&lt;SPAN&gt;) it's using&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;crm.associations.v4.basicApi.create&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;to create an association, but the current node API has:&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;crm.associations.v4.definitionsApi.create&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;, which has different parameters. Could someone help me create an association with this API version?&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;The idea it's to create in the exact same way from the readme example&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2023 01:27:49 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Creating-associations-in-hubspot-api-nodejs-new-version/m-p/803292#M64624</guid>
      <dc:creator>gangelo</dc:creator>
      <dc:date>2023-06-06T01:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating associations in hubspot-api-nodejs new version</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Creating-associations-in-hubspot-api-nodejs-new-version/m-p/803363#M64631</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/579685"&gt;@gangelo&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;create an association with the crm.associations.v4.definitionsApi.create method&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;import { Client } from "@hubspot/api-client";

const hubspotClient = new Client({ accessToken: YOUR_ACCESS_TOKEN });

const associationRequest = {
  fromObjectType: "contact",
  fromObjectId: "1234567890",
  toObjectType: "company",
  toObjectId: "9876543210",
  associationType: "default",
};

await hubspotClient.crm.associations.v4.definitionsApi.create(associationRequest);
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The associationRequest object contains the following properties:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;fromObjectType: The type of the object you're associating (e.g. contact).&lt;BR /&gt;fromObjectId: The ID of the record to associate.&lt;BR /&gt;toObjectType: The type of the object you're associating the record to (e.g. company).&lt;BR /&gt;toObjectId: The ID of the record to associate to.&lt;BR /&gt;associationType: The type of association you want to create. The default value is "default".&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2023 08:16:06 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Creating-associations-in-hubspot-api-nodejs-new-version/m-p/803363#M64631</guid>
      <dc:creator>himanshurauthan</dc:creator>
      <dc:date>2023-06-06T08:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Creating associations in hubspot-api-nodejs new version</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Creating-associations-in-hubspot-api-nodejs-new-version/m-p/803480#M64643</link>
      <description>&lt;P&gt;Hey himanshurauthan! Thank you for the quick answer!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I tried your code here, and it's giving me this warning/error:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SnippingTool_IAupqQupIw.png" style="width: 999px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/92320iBA8747734F6CFA5B/image-size/large?v=v2&amp;amp;px=999" role="button" title="SnippingTool_IAupqQupIw.png" alt="SnippingTool_IAupqQupIw.png" /&gt;&lt;/span&gt;&lt;BR /&gt;As I said in my original question, the create of this version it's different.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;export declare class PromiseDefinitionsApi {
    private api;
    constructor(configuration: Configuration, requestFactory?: DefinitionsApiRequestFactory, responseProcessor?: DefinitionsApiResponseProcessor);
    archive(fromObjectType: string, toObjectType: string, associationTypeId: number, _options?: Configuration): Promise&amp;lt;void&amp;gt;;
    create(fromObjectType: string, toObjectType: string, publicAssociationDefinitionCreateRequest: PublicAssociationDefinitionCreateRequest, _options?: Configuration): Promise&amp;lt;CollectionResponseAssociationSpecWithLabelNoPaging&amp;gt;;
    getAll(fromObjectType: string, toObjectType: string, _options?: Configuration): Promise&amp;lt;CollectionResponseAssociationSpecWithLabelNoPaging&amp;gt;;
    update(fromObjectType: string, toObjectType: string, publicAssociationDefinitionUpdateRequest: PublicAssociationDefinitionUpdateRequest, _options?: Configuration): Promise&amp;lt;void&amp;gt;;
}&lt;/LI-CODE&gt;&lt;P&gt;The create receives 4 parameters&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2023 12:43:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Creating-associations-in-hubspot-api-nodejs-new-version/m-p/803480#M64643</guid>
      <dc:creator>gangelo</dc:creator>
      <dc:date>2023-06-06T12:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating associations in hubspot-api-nodejs new version</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Creating-associations-in-hubspot-api-nodejs-new-version/m-p/804568#M64711</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/579685"&gt;@gangelo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sure, I can help you with that. Here is the code to create an association using the HubSpot Node.js API v4:&lt;/P&gt;
&lt;P&gt;```&lt;BR /&gt;const hubspot = require('hubspot-api-nodejs');&lt;/P&gt;
&lt;P&gt;// Create a new client&lt;BR /&gt;const client = new hubspot.Client({&lt;BR /&gt;apiKey: '&amp;lt;your-api-key&amp;gt;',&lt;BR /&gt;hubspotUrl: '&amp;lt;your-hubspot-url&amp;gt;',&lt;BR /&gt;});&lt;/P&gt;
&lt;P&gt;// Get the contact and company records&lt;BR /&gt;const contact = await client.crm.objects.contacts.get({&lt;BR /&gt;id: '&amp;lt;contact-id&amp;gt;',&lt;BR /&gt;});&lt;/P&gt;
&lt;P&gt;const company = await client.crm.objects.companies.get({&lt;BR /&gt;id: '&amp;lt;company-id&amp;gt;',&lt;BR /&gt;});&lt;/P&gt;
&lt;P&gt;// Create the association&lt;BR /&gt;const association = await client.crm.associations.v4.definitionsApi.create({&lt;BR /&gt;fromObjectType: 'contact',&lt;BR /&gt;fromObjectId: contact.id,&lt;BR /&gt;toObjectType: 'company',&lt;BR /&gt;toObjectId: company.id,&lt;BR /&gt;});&lt;BR /&gt;```&lt;/P&gt;
&lt;P&gt;This code will create an association between the contact and company records. The `fromObjectType` and `fromObjectId` properties specify the contact record, and the `toObjectType` and `toObjectId` properties specify the company record.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this will helps you out. Please mark it as Solution Accepted to help other Community member. &lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 10:52:20 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Creating-associations-in-hubspot-api-nodejs-new-version/m-p/804568#M64711</guid>
      <dc:creator>GRajput</dc:creator>
      <dc:date>2023-06-08T10:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Creating associations in hubspot-api-nodejs new version</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Creating-associations-in-hubspot-api-nodejs-new-version/m-p/810792#M65127</link>
      <description>&lt;P&gt;You can create assocaition while creating the contact object or company object. In v9 of node hubspot/api-client. You need to pass associations parameter while creating an object.&lt;BR /&gt;An example of creating a note and associate with contact.&lt;BR /&gt;```&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;note&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;await&lt;/SPAN&gt; &lt;SPAN&gt;hsClient&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;crm&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;objects&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;notes&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;basicApi&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;create&lt;/SPAN&gt;&lt;SPAN&gt;({&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;properties&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;hs_timestamp&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;moment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TypeId&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&amp;nbsp;&amp;lt;notes_to_deal_associationId&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;});&lt;BR /&gt;&lt;/SPAN&gt;```&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 22 Jun 2023 14:36:36 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Creating-associations-in-hubspot-api-nodejs-new-version/m-p/810792#M65127</guid>
      <dc:creator>alianjum</dc:creator>
      <dc:date>2023-06-22T14:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Creating associations in hubspot-api-nodejs new version</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Creating-associations-in-hubspot-api-nodejs-new-version/m-p/849900#M67479</link>
      <description>&lt;P&gt;Using client v9.1.1&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;client.crm.associations.v4.schema.definitionsApi.create('contact', 'company', {
    name: 'MyName',
    label: 'MyLabel'
  })&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 15 Sep 2023 03:14:24 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Creating-associations-in-hubspot-api-nodejs-new-version/m-p/849900#M67479</guid>
      <dc:creator>DFall9</dc:creator>
      <dc:date>2023-09-15T03:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating associations in hubspot-api-nodejs new version</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Creating-associations-in-hubspot-api-nodejs-new-version/m-p/919235#M70929</link>
      <description>&lt;P&gt;I am not sure what exactly are you trying to do, but if you want to use an HS defined association, just use the crm.associations.v4.basicApi.createDefault(). It receives the 4 first arguments as you sent it, and that's all. The create() allows you to define new custom association types, and label them.&amp;nbsp;&lt;BR /&gt;The basic association between contact and company already defined by HS (and so, it's considered "unlabeled").&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 10:40:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Creating-associations-in-hubspot-api-nodejs-new-version/m-p/919235#M70929</guid>
      <dc:creator>TShma</dc:creator>
      <dc:date>2024-02-08T10:40:15Z</dc:date>
    </item>
  </channel>
</rss>

