简体   繁体   中英

How to query multiple properties from Hubspot using Python?

I am trying to query all deals from Hubspot with dealstage and dealname properties. I can query all deals with either individual property as part of my parameter_dict, but I can't get multiple. Using the code from Hubspot's documentation as a template, I have the following:

    # (Set up connections and parameters above)
    parameter_dict = {'hapikey': hapikey, 'limit': limit, 'properties': 'dealstage', 'properties': 'dealname'}

    has_more = True
    while has_more:
        parameters = urllib.parse.urlencode(parameter_dict)
    # (rest of the code is iterating through and querying everything; nothing different from the code on the site's documentation)

The issue is, when I do this, all I get is the dealname. The documentation said I needed to include the properties field multiple times, once for each property, so I don't understand what I'm doing wrong. Can anyone please clarify?

I have seen the need to insert a property parameter multiple times in the contacts API.

The CRM API description for the deals endpoint explains the properties parameter for deals like this:

String[] A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored.

https://developers.hubspot.com/docs/api/crm/deals

Try

parameter_dict = {'hapikey': hapikey, 'limit': limit, 'properties': ["dealstage", "dealname"]}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM