Context: I have the following code inside a loop, that ends in writing data to a gsheet:
try:
# Fetch individual deal details using its ID
individual_deal = api_client.crm.deals.basic_api.get_by_id(deal.id)
properties_data = individual_deal.properties
# Assign values to the deal_data dictionary
deal_data["Deal Name"] = properties_data.get("dealname", "")
deal_data["Deal Stage"] = properties_data.get("dealstage", "")
deal_data["createdate"] = properties_data.get("createdate", "")
deal_data["amount"] = properties_data.get("amount", "")
deal_data["closedate"] = properties_data.get("closedate", "")
deal_data["hs_lastmodifieddate"] = properties_data.get("hs_lastmodifieddate", "")
# Assign values for additional properties
deal_data["Deal owner"] = properties_data.get("hubspot_owner_id", "")
deal_data["Name of the Clients"] = properties_data.get("name_of_the_clients", "")
deal_data["product_list"] = properties_data.get("product_list", "")
from “# Assign values for additional properties” the problems start because as output I get empty columns. No error. Did I hit a limit of the library or I miscoded my request?
Hey, @GGiordano
Did you get this worked out? If not, I have a few questions to help give the community more information.
Create a test Deal that has values for all the properties you are requesting
-
Try making a request using the on-page example from the Deals API endpoints (share the request and response here)
-
Try making a request using Postman
-
Are you making sure to specify all the properties you want returned? By default, only a subset of properties will be returned
-
Have you tried temporarily adding a debugging step? Something like:
try:
# Fetch individual deal details using its ID
individual_deal = api_client.crm.deals.basic_api.get_by_id(deal.id)
properties_data = individual_deal.properties
print(properties_data)
# Rest of your code...
Thanks! — Jaycee
Unfortunately no.
If I do
deal_data["contact origin"] = properties_data.get("check_of_the_contact_origin")
#the latter comes from the internal name of the variable
print(deal_data["contact origin"])
I get just “none”. Same if I try it inside the Deals API endpoints
HTTP 200
{
"results": [
{
"id": "5868732366",
"properties": {
"check_of_the_contact_origin": null,
"createdate": "2022-11-09T13:32:38.444Z",
"dealstage": "contractsent",
"hs_lastmodifieddate": "2023-05-23T14:02:10.425Z",