[Contact] Get All n Properties Python API v3

trsilva32
Member

Hello Folks,

I'm having a problem extracting data from API Contacts V1(get_contacts_v1)  and V3 (get_contact_v3) , both using python.

- V3 --> How do I use paging on the following code and get the properties like the example bellow:

 

import hubspot
from pprint import pprint
from hubspot.crm import contacts
from hubspot.crm.contacts import ApiException
from hubspot.crm.contacts.models import next_page

client = hubspot.Client.create(api_key="XXXX");

try:
    api_response = client.crm.contacts.basic_api.get_page(limit=100, archived=False, properties=['createdate','work_email','firstname','lastname','mobilephone','phone','website','utm_campaign', 'utm_content',
                 'utm_source','utm_term','company_phone','company_size','contact_source','contact_type','hs_additional_emails',
                 'hs_all_contact_vids','hs_analytics_first_touch_converting_campaign'])                                    
    print(api_response)
except ApiException as e:
    print("Exception when calling basic_api->get_page: %s\n" % e)

 

 

 How I get the next pages results? Someone could help me out, please? 

Also, the result is not showing the infomation that I asked for on properties

 

 

{'archived': False,
              'archived_at': None,
              'associations': None,
              'created_at': datetime.datetime(2015, 7, 27, 18, 27, 28, 25000, tzinfo=tzutc()),
              'id': '511',
              'properties': {'company_phone': None,
                             'company_size': None,
                             'contact_source': None,
                             'contact_type': None,
                             'createdate': '2015-07-27T18:27:28.025Z',
                             'firstname': 'James',
                             'hs_additional_emails': None,
                             'hs_all_contact_vids': '511',
                             'hs_analytics_first_touch_converting_campaign': None,
                             'hs_object_id': '511',
                             'lastmodifieddate': '2021-06-01T18:58:39.116Z',
                             'lastname': 'Anderson',
                             'mobilephone': None,
                             'phone': None,
                             'utm_campaign': None,
                             'utm_content': None,
                             'utm_source': None,
                             'utm_term': None,
                             'website': None,
                             'work_email': None},
              'updated_at': datetime.datetime(2021, 6, 1, 18, 58, 39, 116000, tzinfo=tzutc())},
             {'archived': False,
              'archived_at': None,
              'associations': None,
              'created_at': datetime.datetime(2015, 7, 27, 18, 27, 28, 25000, tzinfo=tzutc()),
              'id': '523',
              'properties': {'company_phone': None,
                             'company_size': None,
                             'contact_source': None,
                             'contact_type': None,
                             'createdate': '2015-07-27T18:27:28.025Z',
                             'firstname': 'Jasmin',
                             'hs_additional_emails': None,
                             'hs_all_contact_vids': '523',
                             'hs_analytics_first_touch_converting_campaign': None,
                             'hs_object_id': '523',
                             'lastmodifieddate': '2021-06-01T18:59:00.658Z',
                             'lastname': 'Kesmez',
                             'mobilephone': None,
                             'phone': None,
                             'utm_campaign': None,
                             'utm_content': None,
                             'utm_source': None,
                             'utm_term': None,
                             'website': None,
                             'work_email': None},
              'updated_at': datetime.datetime(2021, 6, 1, 18, 59, 0, 658000, tzinfo=tzutc())},
             {'archived': False,
              'archived_at': None,
              'associations': None,
              'created_at': datetime.datetime(2015, 7, 27, 18, 27, 28, 25000, tzinfo=tzutc()),
              'id': '529',
              'properties': {'company_phone': None,
                             'company_size': None,
                             'contact_source': None,
                             'contact_type': None,
                             'createdate': '2015-07-27T18:27:28.025Z',
                             'firstname': 'Jason',
                             'hs_additional_emails': None,
                             'hs_all_contact_vids': '529;249436',
                             'hs_analytics_first_touch_converting_campaign': '',
                             'hs_object_id': '529',
                             'lastmodifieddate': '2021-07-26T14:08:50.404Z',
                             'lastname': 'Jubinville',
                             'mobilephone': '(250) 896-7965',
                             'phone': None,
                             'utm_campaign': None,
                             'utm_content': None,
                             'utm_source': None,
                             'utm_term': None,
                             'website': 'https://www.echosec.net/',
                             'work_email': None},
              'updated_at': datetime.datetime(2021, 7, 26, 14, 8, 50, 404000, tzinfo=tzutc())}

 

 

 - On version V1, the result Json is too complex and bring more information that is asked for and I need to transform it in a pandas DataFrame.

 

Can please someone help me out on that?

Tnx 

0 Upvotes
1 Reply 1
webdew
Top Contributor | Diamond Partner

Hi @trsilva32 ,

If you are facing any issue in v3 api's in python then you can use curl access process.
Screen shot : https://prnt.sc/1gjbs6k
Documentation link : https://developers.hubspot.com/docs/api/crm/contacts


Hope this helps!


If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards.

0 Upvotes