APIs & Integrations

DLee31
Member

Custom object API export

First off hubspot makes it really easy to get all native objects out of hubspot a number of ways. The Way I prefer is using this

company = api_client.crm.companies.get_all(properties=[])

 Is there a simliar call for custom objects? I have not found one and this is what my current attempt is to kinda do the same thing. However it will need adjustment since the database will grow above the set number for 52 calls needed. 

iter_id = 0
while i < 52:
    branch = client.crm.objects.basic_api.get_page(object_type="branches",
                                                   limit=100,
                                                   after=iter_id,
                                                   properties=["hs_object_id"]                            
                                                   archived=False)
    #pprint(branch)

    branch = branch.to_dict()

    for data in branch['results']:
        branch_data = {
                       'Hubspot ID': bran['properties']['hs_object_id'],
                       }

        iter_id = data['properties']['hs_object_id']
        branch_list.append(branch_data)

    i += 1

Any guidance is appreciated. End goal is to put the data in a csv file using API. 

 

I know there is a way to download it using this export endpoint however I think that requires a manual download and that is not wanted

0 Upvotes
2 Replies 2
SteveHTM
Key Advisor

Custom object API export

Is the API call for a custom ojecct schema "https://api.hubapi.com/crm/v3/schemas/{custom_object_id}" what you are looking for?

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
DLee31
Member

Custom object API export

Correct. That shows you what custom objects you have created.

 

Im looking for a way to download all objects associated with my custom object called "branch". Above is a way to do it however I was hoping for a similar way to what you can do with the native objects