APIs & Integrations

IntegrationDev
Contributor

Object data fetch - sorting out associations

SOLVE

Hello,

 

When a V3 GET object data request asks for association details (e.g GET {baseUrl}/crm/v3/objects/deals?associations=...), the response sent back contains an association object per relevant association. These objects contain a label property. Can you help me make sense out of these labels? 🙂

 

Example Request:

https://api.hubapi.com/crm/v3/objects/deals?associations=companies

 

Example Response Fragment:

 

{
  "results": [
    {
      "id": "9185082778",
      "properties": {...},
      ...,
      "associations": {
        "companies": {
          "results": [
            {
              "id": "8913841277",
              "type": "deal_to_company"
            },
            {
              "id": "8913841277",
              "type": "deal_to_company_unlabeled"
            },
            {
              "id": "8939397913",
              "type": "deal_to_company_unlabeled"
            },
            {
              "id": "9028443392",
              "type": "deal_to_company_unlabeled"
            },
            {
              "id": "9028444473",
              "type": "deal_to_company_unlabeled"
            },
            {
              "id": "9028443392",
              "type": "facilitator"
            }
          ]
        }
      }
    }
  ]
}

 

My guess on how labels work:

  • It looks like every association gets an "_unlabeled" entry. Example: The above deal is associated with a total of 4 companies, so 4 "deal_to_company_unlabeled" association objects are present.
  • Additionally, it looks like the primary association gets an entry with an "object_to_object" style label (in this case, "deal_to_company"). Since there can only be one primary association, I'm guessing that this label can only appear once in an object's associations collection.
  • Lastly, it looks like any associations with custom labels show up with a corresponding label. Example above: the "facilitator" association.

 

If these rules are applied to the above example, 8913841277 is the primary deal_to_company relationship, 9028443392 has a facilitator relationship and 8939397913 + 9028444473 have a non-primary/non-labeled relationship.

 

Is this the logic that's used?

 

Thank you!

 

0 Upvotes
1 Accepted solution
Jaycee_Lewis
Solution
Community Manager
Community Manager

Object data fetch - sorting out associations

SOLVE

Hi, @IntegrationDev, you got it This knowledge base article give a lot more detail into Association Labels in HubSpot — Create and use association labels

 

Happy building! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

View solution in original post

2 Replies 2
IntegrationDev
Contributor

Object data fetch - sorting out associations

SOLVE

Thank you, @Jaycee_Lewis!

Jaycee_Lewis
Solution
Community Manager
Community Manager

Object data fetch - sorting out associations

SOLVE

Hi, @IntegrationDev, you got it This knowledge base article give a lot more detail into Association Labels in HubSpot — Create and use association labels

 

Happy building! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot