APIs & Integrations

RRompich
Member

Tickets associations

SOLVE

I've been trying to pull emails, tasks, and notes for each of my tickets through the HubSpot API. Basically, I wanted to obtain the association IDs and then call the Engagements API to retrieve that data. I was following this process: https://community.hubspot.com/t5/APIs-Integrations/Get-all-emails-for-a-ticket/m-p/829716 

 

However, I'm encountering a problem: for all my tickets, the associations section shows a 'None' value. What could be the problem? Could it be a very specific issue with my account?

 

Screenshot 2024-03-31 at 00.41.58.png

 

 I am using Python, and this is the offical code provided by HubSpot: 

 

 

import hubspot
from pprint import pprint
from hubspot.crm.objects import ApiException

client = hubspot.Client.create(access_token="----API----")

try:
api_response = client.crm.objects.basic_api.get_by_id(object_type="tickets", object_id="2545436276", archived=False)
pprint(api_response)
except ApiException as e:
print("Exception when calling basic_api->get_by_id: %s\n" % e)

 

0 Upvotes
1 Accepted solution
SteveHTM
Solution
Guide | Partner
Guide | Partner

Tickets associations

SOLVE

@RRompich - honestly, I don't think you are making the API call you think you are here. Its a bit obscured by the hubspot client code library conventions. 

Although the original thread suggested a v3 objects API, I would be very tempted to directly use the most current v4 API code for this:

GET/crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}

Which will list all types of associations - HubSpot and user defined - although that may not be as useful here as it is in other places.

 

I tested this out and it seems to provide full information required.

 

Hope this works for you!

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature

View solution in original post

0 Upvotes
2 Replies 2
SteveHTM
Solution
Guide | Partner
Guide | Partner

Tickets associations

SOLVE

@RRompich - honestly, I don't think you are making the API call you think you are here. Its a bit obscured by the hubspot client code library conventions. 

Although the original thread suggested a v3 objects API, I would be very tempted to directly use the most current v4 API code for this:

GET/crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}

Which will list all types of associations - HubSpot and user defined - although that may not be as useful here as it is in other places.

 

I tested this out and it seems to provide full information required.

 

Hope this works for you!

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature
0 Upvotes
ChrisMagtoto
Member

Tickets associations

SOLVE

You probably need to add the associations param in your call.

api_response = client.crm.objects.basic_api.get_by_id(object_type="tickets", object_id="2545436276", associations=["emails", "notes", ....], archived=False)

 

0 Upvotes