APIs & Integrations

Kralizek
Member

Lack of consistency across the API in naming

Hi,

Trying to work on a .NET client for HubSpot API but I continuously find issues with the lack of consistency across the whole API surface.

The contact object has a property called “canonical-vid” if retrieved via the “get contact by ID” but if you retrieve it as the list of contacts belonging to a company, it’s called “canonicalVid”

Same goes for when retrieving the full list of companies or just the recently updated ones (“companies” vs “results”).

Is there any reason for this?

0 Upvotes
3 Replies 3
Kralizek
Member

Lack of consistency across the API in naming

Another one, not as serious because it doesn’t mess up with the model generation, but still.
When querying for a Contact or a group of them, you can specify the desired properties by adding one or more “property” item in the querystring.
When querying for All companies, you the querystring part to add is “properties”, to be added once for each property.

Get all contacts | Contacts API

GET /contacts/v1/lists/all/contacts/all - For a given portal, return all contacts that have been created in the portal.


0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Lack of consistency across the API in naming

Hi @Kralizek,

As far as I’m aware, there isn’t a particular reason for a discrepancy in those cases. I’d be happy to take a look into some of these discrepancies if you can send me the two endpoints that return different results. It sounds like these two are:

  • Get contact by ID vs. Get contacts in a list (?)
  • Get all companies vs. Get recently updated companies

Are there any other examples that you have seen?

0 Upvotes
Kralizek
Member

Lack of consistency across the API in naming

I’m working on creating a .NET wrapper for the HubSpot REST API and so far I’ve worked only on Contacts and Companies APIs.

But yes, a contact in the list of contacts (or even when you get it by ID) has its properties in a hashset (property name as key), contacts returned by the list of contacts of a company have their properties in a flat array (property name as property).

see:

Get Contacts at a Company | Companies API

GET /companies/v2/companies/:companyId/contacts - Returns all of the contacts who have an associatedcompanyid contact property of :companyid.


0 Upvotes