Hii,
I would like to make a decision about the property of one of my custom objects. Is there any API available for this requirement?
I am including the image of the custom objects included in my account.
I need to get the properties of the custom object that have the name “property”.
In the image the property value(1) is needed and is a property of a custom object named property (2)
Hello @Aiswarya
Retrieve the properties of a specific custom object, you can use the “Get all properties for a specific object” endpoint of the HubSpot API. Here’s an example of how you can achieve this
import requests
# Set up your authentication headers
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
# Replace 'objectType' with the name of your custom object type
object_type = 'property'
# Send a GET request to retrieve the properties
url = f'https://api.hubapi.com/crm/v3/properties/{object_type}'
response = requests.get(url, headers=headers)
if response.status_code == 200:
properties = response.json().get('results', [])
for property in properties:
property_name = property.get('name')
property_value = property.get('value')
print(f"Property Name: {property_name}, Property Value: {property_value}")
else:
print(f"Error: {response.status_code} - {response.text}")
replace ‘YOUR_API_KEY’ with your actual HubSpot API key. Also, update the ‘objectType’ variable with the name of your custom object type, which in your case is ‘property’.
I have tried with this URL “https://api.hubapi.com/crm/v3/properties/property” but it is not working. Please help me to find a solution.
I want to search for a field within the property. Please advise me a way to the same.
Thanks for the reply
@Aiswarya
Hi.
If yout want to get a specific custom object property value, please try this.
method: GET
https://api.hubapi.com/crm/v3/objects/{CUSTOM_OBJECT_ID}/{OBJECT_ID}?properties={PROPERTY_INTERNAL_NAME}
example response:
{
"id": "XXXXXX",
"properties":{
"hs_createdate": "",
"hs_lastmodifieddate": "",
"hs_object_id": "XXXXXXX",
...
},
"createdAt": "...",
"updatedAt": "...",
"archived": false
}
If you want to get a list of custom object , please try this.
method: GET
https://api.hubapi.com/crm/v3/objects/{CUSTOM_OBJECT_ID}/{OBJECT_ID}?properties={PROPERTY_INTERNAL_NAME}
-how to get custom object id
View the list of custom objects in browser.
Please check url.
like this.
https://app.hubspot.com/contacts/{PORTAL_ID}/objects/{CUSTOM_OBJECT_ID}/views/all/list
-how to get internal name
Thanks.