簡體   English   中英

Hubspot API 未填充交易

[英]Hubspot API Not Populating Deal

當我嘗試通過 hubspot api 創建交易時,即使我正在通過填充數據,所創建的所有內容都是完全空白的交易

Api Url: 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)

這是它的結果:

在此處輸入圖像描述

此問題的解決方案是將屬性添加到數據字典

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)

這會根據傳入的數據生成一個已填寫的交易

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM