APIs & Integrations

ganken
メンバー

API Get All Deals with Lead Source

解決

Is there a way for me to get all deals with the lead source property for the deals? The API is returning the lead source when I get a single lead but not in a batch. I tried a few different options but nothing worked. 

 

The below just returns an empty property array. 

https://api.hubapi.com/deals/v1/deal/paged?hapikey= <key> &limit=100&includePropertyVersions=true&properties=lead_source

 

Any help will be much appreciated. 

0 いいね!
1件の承認済みベストアンサー
webdew
解決策
ガイド役 | Diamond Partner
ガイド役 | Diamond Partner

API Get All Deals with Lead Source

解決

Hi @ganken ,

Hope this code work for you :

Api Documentation :
"https://developers.hubspot.com/docs/api/crm/search"

For deal php code fetch result:
<?php
$data = '{
"properties": [ "dealname", "amount", "lead_source" ]
"filterGroups":[
{
"filters":[
{
"propertyName": "<deal_key>",
"operator": "EQ",
"value": "<deal_value>"
}
]
}
]
}';
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.hubapi.com/crm/v3/objects/deals/search?hapikey=YOUR_HUBSPOT_API_KEY');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
?>


Hope this helps!


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

Thanks and Regards. 



元の投稿で解決策を見る

2件の返信
webdew
解決策
ガイド役 | Diamond Partner
ガイド役 | Diamond Partner

API Get All Deals with Lead Source

解決

Hi @ganken ,

Hope this code work for you :

Api Documentation :
"https://developers.hubspot.com/docs/api/crm/search"

For deal php code fetch result:
<?php
$data = '{
"properties": [ "dealname", "amount", "lead_source" ]
"filterGroups":[
{
"filters":[
{
"propertyName": "<deal_key>",
"operator": "EQ",
"value": "<deal_value>"
}
]
}
]
}';
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.hubapi.com/crm/v3/objects/deals/search?hapikey=YOUR_HUBSPOT_API_KEY');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
?>


Hope this helps!


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

Thanks and Regards. 



dennisedson
HubSpot製品開発チーム
HubSpot製品開発チーム

API Get All Deals with Lead Source

解決

@Bryantworks , would you be able to assist here 🙏

0 いいね!