HubSpot Associations V4 API

HubSpot has changed how the API creates associations between objects. I can get the data but cannot figure out how to execute the url via http request and loop through the records.

Does anyone have an example of how they do it? The url requires 4 parameters.

  1. objectType
  2. objectId
  3. toObjectType
  4. toObjectId

Here is the url https://api.hubspot.com/crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}/{toObjectId}

You can only run the url once and then need to loop and run it again using the next record from the previous node.

Hey @davidl,

I don’t have an example but it looks like you should be able to just swap out the {} parts with expressions from a previous node and you will be good to go.

Thanks Jon. I can do that one time but I don’t know how to do that 100 times in a loop. I have used this template successfully for sending the same url multiple times but cannot figure out how to change it to handle the expressions.

Hey @davidl,

Sadly that all depends on your workflow, Most of our nodes will automatically loop so if you have the data in the node before it you could in theory just use something like

https://api.hubspot.com/crm/v4/objects/{{$json.objectType}}/{{$json.objectId}}/associations/{{$json.toObjectType}}/{{$json.toObjectId}}

If the information was from other nodes it would be more complicated but in theory would be something like {{ $('node name').item.json.objectId }} for the expressions.

With the new Batch and Pagination in HTTP Request I got it working. Note that you have to convert the URL to a URL object for it to work.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.