Hello,
I am trying to retrieve data from HubSpot using Hubspot API for python GitHub - HubSpot/hubspot-api-python: HubSpot API Python Client Libraries for V3 version of the API · GitHub.
My code is:
from hubspot import HubSpot
from hubspot.auth.oauth import ApiException
api_client = HubSpot()
client_id = “#####”
client_secret = “#####”
code = ‘#####’
try:
tokens = api_client.auth.oauth.tokens_api.create_token(
grant_type=“authorization_code”,
redirect_uri=“https://www.example.com/auth-callback”,
client_id=client_id,
client_secret=client_secret,
code=code
)
except ApiException as e:
print(“Exception when calling create_token method: %s\n” % e)
api_client = HubSpot(access_token=tokens.access_token)
all_companies = api_client.crm.companies.get_all()
print(all_companies)
However, this request returns me some info about companies. Properties field contains info:
'properties': {'createdate': '2022-04-11T09:35:55.818Z',
'domain': 'mycompany.com',
'hs_lastmodifieddate': '2022-04-11T09:38:27.998Z',
'hs_object_id': '1234567',
'name': 'My Company'},
I need address and postcode for the company. In my account this info is available, I see that this info comes from HubSpot Insights database.
Could you please suggest me how to get company address in my case?
Many thanks!