Get all properties of a Deal object using v3 api.

SOLVE
Ronnie1
Member

Hey everyone,

I have a Deal object with a lot of custom properties and property groups.

 

I'm looking for a way to get them all without typing them all out like this:

api_response = client.crm.deals.basic_api.get_by_id(deal_id="dealId", properties=["hubspot_owner_id, dealstage, etc..."], archived=False)

 

I believe there's a way to achieve this in v1 api using: "includeAllProperties = true"

 

so ideal would be something like this:

api_response = client.crm.deals.basic_api.get_by_id(deal_id="dealId", includeAllProperties = true, archived=False)

 

Thanks for the help!

0 Upvotes
1 Accepted solution

Accepted Solutions
Teun
Solution
Guide | Diamond Partner

Hi @Ronnie1 ,

 

If you just need a overview of all properties, you could use the Deal properties API to get all properties. Alternative would be to export all properties through the HubSpot UI, which would give you a handy spreadsheet of all properties (Settings > Properties > Export all properties).

The quickest way to fix your issue is probably creating an array once and store that as a variable in your script. It is quite an annoying job, but sadly, a solution as includeAllProperties is not available at this time. You can create the array by using the API mentioned above or export all properties to a CSV or XLSX file.

Did my answer solve your issue? Help the community by marking it as the solution.

View solution in original post

3 Replies 3
Teun
Solution
Guide | Diamond Partner

Hi @Ronnie1 ,

 

If you just need a overview of all properties, you could use the Deal properties API to get all properties. Alternative would be to export all properties through the HubSpot UI, which would give you a handy spreadsheet of all properties (Settings > Properties > Export all properties).

The quickest way to fix your issue is probably creating an array once and store that as a variable in your script. It is quite an annoying job, but sadly, a solution as includeAllProperties is not available at this time. You can create the array by using the API mentioned above or export all properties to a CSV or XLSX file.

Did my answer solve your issue? Help the community by marking it as the solution.

View solution in original post

Ronnie1
Member

I quess I'll have to make very long array of properties then.

 

Thanks again.

0 Upvotes
webdew
Top Contributor | Diamond Partner

Hi @Ronnie1 ,
Please use below code for get all deals via API. this code will help's

<?php

$url = 'https://api.hubapi.com/deals/v1/deal/paged?hapikey=demo&includeAssociations=true&limit=2&properties=...';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
$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 Regard.

0 Upvotes