Associations API Get All Returns Blank (Python)

Hello,

In the last week or two my calls to list company associations on a deal stopped working for v3. On deals that I know have a company associated, the API returns no records. Am I calling the API incorrectly or is something else up? I copied the code directly from the API endpoint docs so I’m not sure what else to do here.

This is the code I’m using:

import hubspot

from pprint import pprint

from hubspot.crm.deals import ApiException

myAccessToken = “MyAccessToken”

dealId = 11426070894

client = hubspot.Client.create(access_token=

myAccessToken )

try:

api_response = client.crm.deals.associations_api.get_all(deal_id=dealId

, to_object_type=“companies”, limit=500)

pprint(api_response)

except ApiException as e:

print(“Exception when calling associations_api->get_all: %s\n” % e)

Syrus

Hey @SJarvis6 ,

that is very odd- I’ve tested the code, and it worked fine for me. Can you tell us what error message you’re getting, or is the request just getting through?

Cheers,

Chriso

Hey @ChrisoKlepke ,

The request goes through fine and this is the API reponse i recieve back:

{‘paging’: None, ‘results’: [{‘id’: None, ‘type’: None}]}

When I search the Deal ID with the deals get_by_id call, I see the association there but it’s more convienent if I can use the associations call.

Syrus

Hey @ChrisoKlepke ,

Wondering if you have any new insight to this. One thing i did notice is that the get_deal_by_id call returns two associations for the same company, picture below:

and the associations call returns: {‘id’: None, ‘type’: None}

Not sure if this sheds any more light on the issue. But it is still occuring and causing me a headache.

Thanks,

Syrus