APIs & Integrations

JVermunt
Participant

New object associations not accessible via API

SOLVE

Hi there,

I created a set of association from contacts to appointments, and want to update these via the api.

The appointments object is accessible as object 0-421, but I cannot seem to access the created associations.

If I fetch all schema's the created associations do not show up at all:

 

curl --request GET \
  --url https://api.hubapi.com/crm/v4/associations/definitions/configurations/all \
  --header 'authorization: Bearer YOUR_ACCESS_TOKEN'

 

 

0 Upvotes
2 Accepted solutions
zach_threadint
Solution
Top Contributor

New object associations not accessible via API

SOLVE

Hi @JVermunt 👋

 

Yes, that's right. The Associations API has clear definitions between endpoints that manage the definition of association types (e.g. making it possible to associate individual records) and those that manage associations between individual records.

 

To retrieve associations between individual records, you'll want to use the "Retrieve associated records" endpoint (see "Retrieve associated records" section in this documentation).

 

I hope that proves helpful. Please let me know if you have any follow-up questions.

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.


View solution in original post

0 Upvotes
zach_threadint
Solution
Top Contributor

New object associations not accessible via API

SOLVE

Hi @JVermunt 👋

 

It is currently possible to retrieve both [1] association label definitions via HubSpot's CRM > Associations API and [2] the application of association labels between CRM records via HubSpot's CRM > Objects APIs. For example:

 

  1. GET https://api.hubapi.com/crm/v4/associations/:FROM_OBJECT_TYPE/:TO_OBJECT_TYPE/labels
  2. GET https://api.hubapi.com/crm/v4/objects/:FROM_OBJECT_TYPE/:FROM_OBJECT_ID/associations/:TO_OBJECT_TYPE

I hope that proves helpful. Please let me know if you have any follow-up questions.

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.


View solution in original post

0 Upvotes
8 Replies 8
zach_threadint
Top Contributor

New object associations not accessible via API

SOLVE

Hi @JVermunt 👋

 

As per HubSpot's API docs (see "Retrieve association limits" section), the GET /crm/v4/associations/definitions/configurations/all API endpoint is intended for you to "read all defined association limits". It returns "custom association limits defined across all objects".

 

It sounds like you might be more interested in using the "Create and manage association types" section within the relevant HubSpot API documentation?

 

I hope that proves helpful. Please let me know if you have any follow-up questions.

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.


JVermunt
Participant

New object associations not accessible via API

SOLVE

Hi @zach_threadint 👋

The "Create and manage association types" API returns no association from contacts to appointments, which is why I used the read all defined association limitsto check on all associations.

0 Upvotes
zach_threadint
Solution
Top Contributor

New object associations not accessible via API

SOLVE

Hi @JVermunt 👋

 

Yes, that's right. The Associations API has clear definitions between endpoints that manage the definition of association types (e.g. making it possible to associate individual records) and those that manage associations between individual records.

 

To retrieve associations between individual records, you'll want to use the "Retrieve associated records" endpoint (see "Retrieve associated records" section in this documentation).

 

I hope that proves helpful. Please let me know if you have any follow-up questions.

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.


0 Upvotes
JVermunt
Participant

New object associations not accessible via API

SOLVE

Based on this thread I conclude that it is not yet possible to access the association label for the new objects via the API.

Do you know if this is on the roadmap in the near future?

0 Upvotes
zach_threadint
Solution
Top Contributor

New object associations not accessible via API

SOLVE

Hi @JVermunt 👋

 

It is currently possible to retrieve both [1] association label definitions via HubSpot's CRM > Associations API and [2] the application of association labels between CRM records via HubSpot's CRM > Objects APIs. For example:

 

  1. GET https://api.hubapi.com/crm/v4/associations/:FROM_OBJECT_TYPE/:TO_OBJECT_TYPE/labels
  2. GET https://api.hubapi.com/crm/v4/objects/:FROM_OBJECT_TYPE/:FROM_OBJECT_ID/associations/:TO_OBJECT_TYPE

I hope that proves helpful. Please let me know if you have any follow-up questions.

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.


0 Upvotes
JVermunt
Participant

New object associations not accessible via API

SOLVE

Hi @zach_threadint,

Thank you for your clarification and persistence, your answers helped me in finding the problem I had.
I used the api's you suggested using the pyton requests package:

 

url = f"https://api.hubapi.com/crm/v4/associations/{ObjectType.APPOINTMENT.value}/{ObjectType.CONTACT.value}/labels"

response = requests.get(
        url, headers={"Authorization": f"Bearer {client.access_token}"}
    )

pprint(response.json())

 

 

This worked as intented and returned the USER_DEFINED associations.

Previously, I was using the hubspot python client which did not give me the results:

 

def explore_associations(client, from_object_type, to_object_type):
    api_response = client.crm.associations.v4.schema.definition_configurations_api.get_all_between_two_object_types(
        from_object_type=from_object_type, to_object_type=to_object_type
    )

 

 


So in conclusion, the association labels of the new objects do definitely work with the api, but I couldn't get it to work using the current version of the HubSpot python api and switched to using the regular requests package.

BérangèreL
Community Manager
Community Manager

New object associations not accessible via API

SOLVE

Hi @JVermunt, I hope that you are well!

Thanks for asking the Community!

I understand that you are trying to view all the associations with the appointment object. Please let me know if that's not the case.

I'd like to share this article "View a model of your CRM object and activity relationships" for information on the new appointment object.

Since this is a new CRM object, it may be that it is not yet accessible via API. I will double check on this internally for you.

In the meantime, I'd love to put you in touch with some of our Top Experts and Community Members:

Hi @rw1982, @HubDoPete, @Jonas_De_Mets and @zach_threadint have you tried API calls with the new appointment object? If yes, do you have suggestions to help @JVermunt, please?

Thanks so much and have a lovely day!

Best,
Bérangère


Saviez-vous que la Communauté est disponible en Français ?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings!


0 Upvotes
JVermunt
Participant

New object associations not accessible via API

SOLVE

Hi @BérangèreL, I'm doing great!

Thanks for the information and references. I would like to add that the records itself from appointsments are accessible via the API, including the existing associations that are made. 

The problem that I face is that I cannot find the associations schema and add associations to objects.

For more context, I want to use the appointments objects to track our events, where I connect contacts to the appointments with a no-show, show, registered or canceled label.
For example, our operational manager will upload the show list of the event to HubSpot, where a custom coded action will update all the associations labels of the contacts to the event.

0 Upvotes