In my experience most API calls have a limit of 100.
The documentation points to Rate Limits rather than the Limit Parameter, so I would try your code with a limit of 100.
Did that work?
Mike
Here to learn more about HubSpot and share my HubSpot Knowledge. I’m the founder of Webalite a HubSpot Partner Agency based in Wellington, New Zealand and the founder of Portal-iQ the world’s first automated HubSpot Portal Audit that helps you work smarter with HubSpot.
Just wanted to throw in a strong upvote for this; I don’t know why the HubSpot API documentation
Never seems to use the same method of querying itself twice
Has examples with immediate top-level errors so frequently
I’ve usually been able to puzzle my way through it (and will report back here if I can fix this too) but the documentation being inconsistent and wrong is a huge barrier to entry here; especially for folks who are just trying to custom code query their own instance.
With the warning that I am not a node developer, but an amateur who hacks things to work in HubSpot workflows, I was able to get the response I wanted with a more generic request made to the v4 API. HubSpot’s custom code actions don’t actually support the version of the HubSpot API Client that the v4 Associations API is on, which is nightmarish, and their editor hates the sample code you were using (which I know is what is in the documentation HubSpot themselves provides).
For reference, here is HubSpot’s documentation showing which version of their own api the custom code action supports (v8), and here is them saying that Associations v4 is only on v9 and higher, so you have to use the generic http request to use the Associations v4 API.
Here is the code I used in my custom code action, where I am trying to retrieve all Companies associated to the Deal the workflow is running from. ‘record_id’ is my input variable of the deal’s id, and it’s outputting the whole response as a string for a future code action. Use at your own risk, this is only to the best of my current ability and not something I can validate.
Thank you very much for your thoughts on this topic and for the example you gave. You are absolutely right - at the moment we have to work with the wrong documentation and use alternative approaches.
Just as a note, I tried the example on my local machine with the latest version of hubspot/api-client and it doesn’t work there either.
Ah (huh, HubSpot censors h*ll, that’s funny) - I’m not sure exactly where the distinction would be; as my example is running in custom code actions on their API v8.
Except - you might not have the https protocol in your package? The example actually just doesn’t use the HubSpot API at all due to the issues you identified. Depending on how you’re executing (looks like node) you may also need to swap out require for
Totally fine, thanks for the clarification! Glad that you’ve got something working. Even though the documentation is still wrong, would you mind marking my previous response as a solution? It might help other folks with the same problem. No worries if not!