【问题标题】:Hubspot API Not Populating DealHubspot API 未填充交易
【发布时间】:2021-08-29 19:36:28
【问题描述】:

当我尝试通过 hubspot api 创建交易时,即使我正在通过填充数据,所创建的只是一个完全空白的交易

API 网址:https://developers.hubspot.com/docs/api/crm/deals

这是我正在尝试的以下代码:

import json

import requests

hubspot_api_key = "MY_API_KEY"

url = 'https://api.hubapi.com/crm/v3/objects/deals?hapikey={}'.format(hubspot_api_key)

headers = {"Content-Type": "application/json"}
deals_post = {
    'amount': "4034.75",
    'closedate': '2021-05-10T12:04:00.000Z',
    'dealname': 'Custom data integrations',
    'dealstage': 'closedwon',
    'hubspot_owner_id': "5448459615",
    'pipeline': 'default'
}

response = requests.post(url, headers=headers, data=json.dumps(deals_post))
print(response.text)

这是它的结果:

【问题讨论】:

    标签: python api python-requests crm hubspot


    【解决方案1】:

    解决此问题的方法是向数据字典添加属性

    import json
    
    import requests
    
    hubspot_api_key = "MY_API_KEY"
    
    url = 'https://api.hubapi.com/crm/v3/objects/deals?hapikey={}'.format(hubspot_api_key)
    
    headers = {"Content-Type": "application/json"}
    deals_post = {
        'properties': {
            'amount': "4034.75",
            'closedate': '2021-05-10T12:04:00.000Z',
            'dealname': 'Custom data integrations',
            'dealstage': 'closedwon',
            'hubspot_owner_id': 83849850,
            'pipeline': 'default'
        }
    }
    
    response = requests.post(url, headers=headers, data=json.dumps(deals_post))
    print(response.text)
    

    这会导致根据传入的数据填写交易

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-30
      • 2016-12-22
      • 1970-01-01
      • 1970-01-01
      • 2015-10-20
      • 1970-01-01
      • 1970-01-01
      • 2016-10-07
      相关资源
      最近更新 更多