HubSpot/hubspot-api-nodejs

Are CRM object IDs numbers or strings?

stevekanter opened this issue · 4 comments

It seems unclear if CRM objects (Deal, Contact, Company, at least) have string IDs or number IDs.

Even the README in this repo is not correct https://github.com/HubSpot/hubspot-api-nodejs#example-create-contact-company-and-associate-created-objects

It says to use the id of hubspotClient.crm.contacts.basicApi.create and pass that into hubspotClient.crm.associations.v4.basicApi.create. However, the former returns a TypeScript type that has id typed as a string and the latter wants a number.

Which is it? Until this gets resolved, I either have to cast my types or I need to use parseInt on the string being returned from the creation call. Both feel icky.

I just checked the API Docs (which I can't directly link to because the docs don't deep link, another pet peeve) and it implies that the ID gets passed in as a path parameter but wants an integer. Technically speaking, integers can get coerced into a string, but if we're being strictly accurate, it sounds like the v4 association API is incorrect and it should be labeled as a string.

image

Hi @stevekanter .
It is a bug. The Id have to be string.
The SDK is auto-generated based on swagger files.
I have made request for fixing it.
When it is fixed, I'll regenerate the SDK.

@ksvirkou-hubspot any updates about this issue? In v 10.2.0 it's still typed as number

Hi everyone.
It have been fixed in the latest version of the SDK(11.0.0)